动态加载onclick事件中的变量问题

错误的方法:
mycurrent_row.attachEvent("onclick",function(){document.getElementById('JobCateDetail').value = strArray[x].split("#")[1];});

正确的方法:
(function (x){mycurrent_row.attachEvent("onclick",function(){document.getElementById('JobCateDetail').value = strArray[x].split("#")[1];})})(i)

其中i为设置动态加载函数中的变量

posted on 2008-07-04 15:09  Eric Zhang  阅读(967)  评论(0编辑  收藏  举报

导航