As shown in the figure, you can see from the code that the screenshot method is triggered by a stand-alone machine, but why is it triggered by double-click in reality?

<img  id="jp" src="../../../images/common/img/jt.png" onclick="catchScreen()"/>"


function catchScreen(){
    
    PrintScreen.BeginCatchScreen();
}

var PrintScreen = {
        BeginCatchScreen:function(){
            try{
                var catchScreen = document.getElementById("CatchScreen");
                if(catchScreen.getVersion()<1002){
                    Ext.Msg.alert("",",!!",function(val){
                        if(val=="ok"){
                            var isWnd = window.open("down.html","activex","");
                            isWnd.moveTo(0,0);
                            isWnd.focus();
                        }
                    });
                    return;
                } 
                //alert(serverName+serverPort+basepath);
                catchScreen.BeginCatchScreen(serverName,serverPort,basepath+"/fileUploadAction.do?functionType=catchscreen",1);
            }catch(e){
                Ext.Msg.alert("",",!!",function(val){
                    if(val=="ok"){
                        var isWnd = window.open("down.html","activex","");
                        isWnd.moveTo(0,0);
                        isWnd.focus();
                    }
                });
            }
            
        },
        showPrintScreen:function(){
            var catchScreen = Ext.getDom("CatchScreen");
            var filepath = catchScreen.GetFileName();
            //alert(filepath);
            var inputMsg =document.getElementById("message");
            var img = "<img width="210px" height="150px" ondblclick="screenDblclick(\""+filepath+"\")" src="../../../"+filepath+""  alt="screenimg">";
            //
        //    var inputMsgHtml = inputMsg.innerHTML;
            MsgNode.msg = filepath;
            inputMsg.innerHTML = img;
        },
        filterContent:function(content){
            var newContent = content;
            if(newContent.indexOf("screenimg")!=-1){
                filepath = newContent.split("=")[1];
                newContent = "<img class=\"catchScreenImg\" ondblclick="screenDblclick(\""+filepath+"\")" src="../"+filepath+""  alt="screenimg">";
            }
            for(var p in emotions){
                while(newContent.indexOf("[-sharp"+emotions[p].EMOCODE+"]")!=-1){        
                    newContent = newContent.replace("[-sharp"+emotions[p].EMOCODE+"]","<img src="images/emotion/"+emotions[p].SRC+"" />");
                }
            }
            return newContent;
        }
}

A strange problem can be seen from the code that when you click the "img" tag, the screenshot method is triggered, and the breakpoint aler goes the same way, but the actual situation is: click does not respond, only double-click can trigger the screenshot method, it feels very strange

Aug.10,2021

an error is reported because the dom element obtained through id does not have a dblclick method. When an error is reported, the function is terminated and an error is thrown until it is captured. Dblclick assumes that you made a mistake, and there is only the click method on dom. If you change it to: document.getElementById ("jp"). Click (); , it will be alert in turn), which matches the name of your doubleclick method.


first of all, there is a problem with your code. Calling ondblclick, instead of dblclick, and ondblclick should be equal to a function, but there is no binding method to ondblclick on the node, so the call is to throw an error directly.
is an example of normal operation. You can take a look at my supplementary code, binding the ondblclick event to the node, so it will pop up normally when calling. If you bind doubleclick, it will be dead loop. If in doubt, welcome to follow up!

  

your img tag does not define the ondblclick method. When you click the button and execute until the double-click event, you report an error, and the following code does not execute. So it won't alert.

Menu