js判断每个框架内的form表单个数?
1.html:
<frameset name= "pdi " rows= "33%,* " frameborder= "yes " border= "0 " framespacing= "0 ">
<frame name= "aaa " scrolling= "no " framespacing=1 src= "2.html ">
<frame name= "bbb " scrolling= "no " framespacing=1 src= "3.html ">
2.html:
<form name= 'aaa_form ' method=post>
<input type=button name=input1 value= '判断 ' onclick= 'test(); '>
</form>
<SCRIPT LANGUAGE= "JavaScript ">
function test() {
var frameall=parent.pdi.getElementsByTagName( "FRAME ");
for(var i=0;i <frameall.length;i++){
alert(frameall[i].document.forms.length);
}
}
</SCRIPT>
3.html:
<form name= 'bbb_form ' method=post>
<input type=button name=input value= '测试 '>
</form>
为什么返回值都是0?谢谢了!
------解决方案--------------------alert(parent.frames[i].document.forms.length);