onclick 为什么成只读属性了?
在JS中为链接设置onclick,运行时却显示为如下错误:
Uncaught TypeError: Cannot assign to read only property 'onclick' of 4
程序为:
window.onload = function(){
var as = document.getElementsByTagName("a");
for (var i in as){
as[i].onclick = function(){
ShowPic(this);
return false;
}
}
}
但好像能正常运行。