Write it like this:
This method is called when the onXXXevent() event of the acitveX control is triggered.
It would be okay if it were only one and a half, but dozens of such functions fill up my page. Moreover, in VS2008, "Set selected content formatting" always prompts: "The operation could not be completed."
So I want to use another way to replace this kind of writing. At the very least, I can put it in in a separate js file.
VBScript implementation is very strange
sub activex_onXXXevent()
' Processing specific content
end sub
I don’t understand.
Oh, this method can be perfectly implemented and can be placed in a JS file. VS2008 can also support it.
By the way, record the content of attachEvent
In recent work, the attachEvent method has been used. This method can attach other processing events to a certain event. Sometimes it may be useful. Here is a summary of its basic usage.
For its syntax, you can view the "DHTML Manual", which has detailed instructions. Here is an example, which comes from the Internet:
document.getElementById("btn").onclick = method1;
document.getElementById("btn").onclick = method2;
document. getElementById("btn").onclick = method3;
If written like this, only medhot3 will be executed
Written like this:
var btn1Obj = document.getElementById("btn1");
//object.attachEvent(event,function) ;
btn1Obj.attachEvent("onclick",method1);
btn1Obj.attachEvent("onclick",method2);
btn1Obj.attachEvent("onclick",method3);
The execution order is method3->method2->method1
If it is the Mozilla series, this method is not supported, and you need to use addEventListener
var btn1Obj = document.getElementById("btn1");
//element.addEventListener(type,listener,useCapture) ;
btn1Obj.addEventListener("click",method1,false);
btn1Obj.addEventListener("click",method2,false);
btn1Obj.addEventListener("click",method3,false);
The execution order is method1->method2->method3