我想在top里面操作main里的div让他隐藏或者显示
  var B=window.parent.frames["main"]; B.document.getElementById("tishi").style.display="block";
    parent.main.document.getElementById("tishi").style.display="block";
貌似不太成功大家给改改

解决方案 »

  1.   

    你不需要定位框架的位置,,直接把   让 DIV 影藏的代码写在   main 页面里面就行了 document.getElementById("tishi").style.display="block";  写在 main 指定的页面 
      

  2.   

    用JS操作FRAME中的IFRAME及其内容
    http://blog.csdn.net/theforever/archive/2008/07/10/2631903.aspx
    FRAME中的IFRAME都能操作,FRAME中的其它对象操作自然没问题。获取/设置IFRAME内对象元素的几种JS方法
    http://blog.csdn.net/theforever/archive/2011/01/10/6126635.aspx
      

  3.   

    可以参考的资料如下:
    页面是三个框架页面组成 
    topfra 放头文件 
    leftfra 放树菜单 
    mainfra 主页面 代码: 
    <frameset rows="120,*" cols="*" framespacing="0" frameborder="NO" border="0"> 
    <frame src="top.shtml" name="topFrame" id="topFrame" scrolling="NO" noresize /> 
    <frameset name="midFrame" rows="*" cols="210,*" framespacing="0" frameborder="NO" border="0"> 
    <frame src="left.shtml" name="leftfra" scrolling="YES" noresize id="leftfra"/> 
    <frame src="mall.shtml" name="mainfra" scrolling="YES" noresize id="mainfra" /> 
    </frameset /> ============================== 
    leftfra框架引用了 aaa.js文件 
    aaa.js内定义了 
    function test() 

        alert("test"); 
    } ============================== 
    mainfra框架引用了 bbb.js文件 
    bbb.js内容如下. document.getElementById("content").innerHTML = "<a href='javascript:parent.leftfra.test();'>aaaa</a>"; ====================================== 现在这样调用调用不了..但是调用parent.leftfra.document.getElementById("info").value却是可以的..---------------------------------------------------------------------------------------------
    http://www.jiemengwu.com/ 解梦屋 http://www.phpzy.com/php/ 绿色php资源http://www.shopfw.com网店服务