a.html中window.open(rul,"mainFrame")OR<a href="http://xxx" target="mainFrame">123</a>

解决方案 »

  1.   

    Sorry, url not rulwindow.open(url,"mainFrame","")
      

  2.   

    <a href="" target=""></a>
      

  3.   

    不对啊!我是这样的,a.html是一个普通页面,从a.html页面打开b.html(新窗口中),
    b.html是主框架页面,其中有三个框架页面分topFrame,mainFrame,buttomFrame.我想在a.html中动态的指定mainFrame中装载的链接。
      

  4.   

    a.html:<script>
    window.open("b.html");
    </script>
    <a href="http://www.csdn.net/" target="mainFrame">csdn</a>
    <a href="#" onclick="window.open('http://www.csdn.net/','mainFrame')">csdn</a>
    b.html:<frameset rows="30,100%,30" cols="*" framespacing="0" frameborder="no" bordercolor="#000000" style="border:1px solid WindowText;">
      <frame src="topFrame.htm" name="topFrame" scrolling="NO" noresize="true" >
      <frame src="mainFrame1.html" name="mainFrame" id="mainFrame" scrolling="NO">
      <frame srcbuttomFrame.htm" name="bottomFrame" scrolling="NO" noresize="true">
    </frameset>
      

  5.   

    不是这样的。
    b.html是一个多用途的框架页面。我要根据需要打开b.html,但每次mainFrame调用的是不同页面,而不是b.html页面一直开着的。
      

  6.   

    a.html:<script>
    var newwin=window.open("temp.htm");
    newwin.document.frames("mainFrame").location.href="http://www.csdn.net/"
    </script>b.html:<frameset rows="30,100%,30" cols="*" framespacing="0" frameborder="no" bordercolor="#000000" style="border:1px solid WindowText;">
      <frame src="topFrame.htm" name="topFrame" scrolling="NO" noresize="true" >
      <frame src="mainFrame1.html" name="mainFrame" id="mainFrame" scrolling="NO">
      <frame srcbuttomFrame.htm" name="bottomFrame" scrolling="NO" noresize="true">
    </frameset>
      

  7.   

    a.html:<script>
    var newwin=window.open("b.html");
    newwin.document.frames("mainFrame").location="http://www.csdn.net/"
    </script>b.html:<frameset rows="30,100%,30" cols="*" framespacing="0" frameborder="no" bordercolor="#000000" style="border:1px solid WindowText;">
      <frame src="topFrame.htm" name="topFrame" scrolling="NO" noresize="true" >
      <frame src="mainFrame1.html" name="mainFrame" id="mainFrame" scrolling="NO">
      <frame srcbuttomFrame.htm" name="bottomFrame" scrolling="NO" noresize="true">
    </frameset>
      

  8.   

    不行,提示发生意外!查看了一下,好象是window对象是生成了,但mainFrame对象还没生成!
    我想到一个方法,就是在a中用js写出b中html代码。但感觉上好象更麻烦!
      

  9.   

    还有办法,就是调用两次window.open
    第一次打开b.html:
    window.open("b.html");
    第二次:
    window.open("http://www.csdn.net","mainFrame");
    这样就可以了。
    大家看如何?
      

  10.   

    你先检测一下b.html是否加载再执行就不会出错了
      

  11.   

    那就使用window.open("b.html?url=http://www.csdn.net");在b.html获得这个url,然后再重新写入整个frameset