function selectAll(obj)
{
var a = document.all;
for(var i=0;i<a.length;i++)
{
if(a[i].tagName=="INPUT"&&a[i].type=="checkbox"&&a[i]!=obj)
{
a[i].checked = !a[i].checked;
}
}
}//见tagName和type
{
var a = document.all;
for(var i=0;i<a.length;i++)
{
if(a[i].tagName=="INPUT"&&a[i].type=="checkbox"&&a[i]!=obj)
{
a[i].checked = !a[i].checked;
}
}
}//见tagName和type
a就是javascript对象<input >就是html对象,
而且有些html对象好像还没有tagName,如window对象
<!--
var a;function testobject(obj)
{ if(typeof(obj)=='object'&&typeof(obj.tagName)!='undefined')
{
alert('html object');
}
else
{
alert('javascirpt object');
}}testobject(a);//-->
</script>
我能区分html对象和javascript对象,但如何区分具体的html对象和javascript对象了
如得到一个html object,我如何知道是window对象,frame对象,text对象,还是table对象,tr对象了?
对javascript对象来说,如何区分是String对象,Array对象了?
{
if(obj!=null&&typeof(obj)=='object'&&typeof(obj.tagName)!='undefined'&&typeof(obj.constructor)!='function')
{
alert('html object');
}
else
{
alert('javascirpt object');
}
}
frame,text,table等HTML对象看其tagName
window对象随便找它的一个特殊属性,看typeof是否是undefine