先上码:
<html><head></head><FRAMESET rows="90,*" frameSpacing=0 frameBorder=no border=0 id=index> <FRAME id=topFrame name=topFrame src="../index/admin_top.jsp" noResize scrolling=no> <FRAMESET border=0 frameSpacing=0 id=colsIndex frameBorder=no cols=250,11,*> <FRAME marginheight= "0" marginwidth= "0" id=leftFrame name=leftFrame src="../index/left.jsp" noResize scrolling=no> <FRAME src="../index/middle.jsp" name=middleFrame scrolling=no noResize id=middleFrame> <FRAMESET border=0 frameSpacing=0 id=colsIndexSon frameBorder=no rows=250,*> <FRAME id=selectFrame name=selectFrame marginheight= "1" marginwidth= "1" src="../index/select.jsp" scrolling=no> <FRAME marginheight= "1" marginwidth= "1" id=mainFrame name=mainFrame src="../jump.do?type=city_city" scrolling=no> </FRAMESET> </FRAMESET></FRAMESET> <body></body></html>
function isShowNav(){alert(window.parent.colsIndex.cols); if(window.parent.colsIndex.cols == "250,11,*"){ window.parent.colsIndex.cols = "0,11,*"; }else{ window.parent.colsIndex.cols = "250,11,*"; }}
增加一层,就要增加一个parent
如window.parent.parent之类的
就你这个结构从middleFrame中操作colsIndex frameset没有问题,我这里测试过了,不过非ie浏览器无法使用,因为不能那样获取colsIndex
function isShowNav() { var colsIndex = parent.document.getElementById('colsIndex'); alert(colsIndex.cols); if (colsIndex.cols == "250,11,*") { colsIndex.cols = "0,11,*"; } else { colsIndex.cols = "250,11,*"; } }