javascript:mctmp(0);
in ie6:
document.getElementsByName(nameValue) will return the element which id attribute equals to nameValue
document.getElementById(idValue) will return the element which name attribute equals to idValue
[b]so prevent to use the same id and name attribute value in dom![/b]
in ie6:
document.getElementsByName(nameValue) will return the element which id attribute equals to nameValue
document.getElementById(idValue) will return the element which name attribute equals to idValue
[b]so prevent to use the same id and name attribute value in dom![/b]
var getElementById = function(id){
var el = document.getElementById(id);
if(!+"\v1"){//ie
//直接用el.id的方式来取值,无论是在IE还是标准浏览器,都无法取得正确值,而是返回元素本身的toString()。
if(el && el.attributes['id'].value === id){
return el
}else{
var els = document.all[id],n = els.length;
for(var i=0;i<n;i++){
if(els[i].attributes['id'].value === id){
return els[i]
}
}
}
}
return el;
}