2009-12-09 69 views

回答

3

你可以使用這樣的事情:

element.addEventListener ('click', (function (myParam) { 
    return function() { 
     // user myParam here 
    }; 
}) (yourParam), false); 

無論你傳遞什麼「yourParam」將通過「myParam」參數訪問事件處理程序...

+1

這工作對我來說: attachEvent('onclick',function(){ linkClicked(link.getAttribute (「命令」)); },false); – samuel 2009-12-09 12:55:36

3

你可以在你的處理器使用的getAttribute,像

var param = this.getAttribute('command');

+0

它不起作用 – samuel 2009-12-09 12:34:36

相關問題