日期:2014-05-16  浏览次数:20447 次

请教DOM接点的自定义事件
function   list_open_close(id)
{
var   new_img=document.createElement( "img ");
new_img.setAttribute( "src ", "picture/extent.png ")
new_img.setAttribute( "id ",id)
new_img.addEeventListener( "click ",list_open_close(this.id),true)
}

请问怎样为DOM元素定义自定义事件?为new_img元素的click事件定义list_open_close。该事件的参数是该元素的性质ID
new_img.addEeventListener( "click ",list_open_close(this.id),true)要怎样写

------解决方案--------------------
new_img.addEeventListener( "click ",new function ( "list_open_close( ' "&this.id& " ') ");