日期:2014-05-16  浏览次数:20556 次

js判断frame?
<frameset   name= "pdi "   rows= "50,* "   frameborder= "auto "   border= "0 "   framespacing= "0 ">  
<frame   name= "oper "   scrolling= "no "     src= "op.php ">
<frameset   name= "main "   cols= "105,* "   frameborder= "auto "   border= "0 "   framespacing= "0 ">  
<frame   name= "unit "   scrolling= "no "     src= "unit.php ">
<frameset   name= "right "   rows= "50%,* "   frameborder= "auto "   border= "0 "   framespacing= "0 ">  
<frame   name= "batch "   scrolling= "auto "     src= "batch.php ">
<frame   name= "slab "   scrolling= "auto "     src= "slab.php ">

1.当前框架是oper这个框架,我想获得main下面有多少个frame?
2.unit,batch,slab框架的页面都有复选框,我想在oper的框架中做判断,只允许一个框架中有选中(比如unit、batch框架下的复选框都有选中的话,提示错误)。
谢谢大家!

------解决方案--------------------
1. top.main.getElementsByTagName( "FRAME ").length;
2.判断
if(top.unit.document.formname.chkname.checked)..
if(top.batch.document.formname.chkname.checked)..
if(top.slab.document.formname.chkname.checked)..

如果chkname多于1个用chkname[i].checked判断
------解决方案--------------------
每个frame的ID取上名字! 用document.getElementById( "frameID ")就可以了