2010-03-20 74 views

回答

0

雖然你不能直接這樣做,你可以用一對夫婦的內置功能,並創建onmousedown事件屬性元素的數組。

// get all anchor tags 
var anchors = document.getElementsByTagName('a'); 
// empty array to store matches in 
var matches = []; 

// loop through all anchors 
for (var i = 0, len = anchors.length; i < length; i++) 
{ 
    // if there is an onmousedown function, add it to the array 
    if (typeof anchors[i].onmousedown === 'function') 
    { 
     matches.push(anchors[i]); 
    } 
} 
0

我不認爲你可以。

如果這是你的腳本的一個設置onmousedown事件時,你可以修改它,把它添加到您設置事件處理的DOM元素的屬性,這樣你就可以在以後測試屬性。