<strong>以下程式碼,會先執行onclick,然後再執行事件監控</strong>: <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="92278" class="copybut" id="copybut92278" onclick="doCopy('code92278')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code92278"> <br> <br> <br><title>JK Test</title> <br><meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <br><script src="http://s0.qhimg.com/lib/qwrap/110.js" type="text/javascript"></script> <br><style> <BR>div{border:1px solid balck;padding:5px;margin:2px;} <BR></style> <br> <br> <br><div id="div1" onclick="alert(1);">div1 原生的fireEvent,是先運行onclick,再運行listeners <br> </div> <br> <br><script type="text/javascript"> <BR>var fun=function(e){ <BR>alert('hello'); <BR>}; <BR>W('#div1').addEventListener('click',fun).fire('click' ); //QW裡呼叫的是原生方法<BR></script> <br> <br> </div> <br><strong>JQuery的執行順序恰恰相反</strong>: <br> <div class="codetitle"> <span><a style="CURSOR: pointer" data="83992" class="copybut" id="copybut83992" onclick="doCopy('code83992')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code83992"> <br> <br> <br> <br> <br><title> JK Test</title> <br><meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <br><script src="http://s0.qhimg.com/%20lib/jquery/172.js" type="text/javascript"></script> <br><style> <BR>div{border:1px solid balck;padding:5px;margin:2px;} <BR>< /style> <BR> <BR><body> <BR><div id="div2" onclick="alert(2);" >div2 JQuery,先執行listeners,再執行onclick <BR>< /div> <BR> <BR><script type="text/javascript"> <BR>var fun=function(e){ <BR>alert('hello'); <BR>}; <BR>$('#div2').bind('click',fun).trigger('click'); <BR> </style> </div> <br> 掃了一下jq的trigger的實現,也沒弄清楚顛倒的目的是什麼。