自定义函数fn
<link rel="stylesheet" href="theme-gray-all.css"> <script src="ext-all.js" ></script> <script type="text/javascript"> Ext.onReady(function(){ var fn = function(e, el, args) { alert("handle1"); alert(args.testId); }; Ext.get('test').on('click', fn, this, { single: true, delay: 100, testId: 4 }); }); </script> <button id="test">测试</button>
调用顺序
<link rel="stylesheet" href="theme-gray-all.css"> <script src="ext-all.js" ></script> <script type="text/javascript"> Ext.onReady(function(){ var EXTtest = Ext.get('test'); EXTtest.on('click', function() { alert("handle1"); }); EXTtest.on('click', function() { alert("handle2"); }); }); </script> <button id="test">显示</button>
<button><script>先后顺序问题
<button id="test">显示</button> <script type="text/javascript"> var e = document.getElementById("test"); e.onclick = function() { alert("handle1"); }; e.onclick = function() { alert("handle2"); }; </script>