2.html
3.html
<iframe src="2.html" id="myframe">
<script js>
myframe.location.href="3.html">
var obj=myframe.document.all.button;
alert(obj);
</script>
如果没有了href 那一句当然没有错拉
但这样会提示错误

解决方案 »

  1.   

    1.html 上有一个button
    其代码如下:
    function a()
    {
    myframe.location.href="foursystem.aspx";
    productFrame=myframe.document.all;
    alert(product.button.id);
    }2.html 上有一个button 跟一个textbox3.html 上什么都没有
    2.button 的任务就是跳到3.html当2.html 的按钮没有按下的时候也就是没有跳页的时候
    按下1.html button 没错误
    但按下了2.button 以后这时跳到了3.html
    然后按下1.button 就出错了
      

  2.   

    1.html:
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script language="javascript">
    function a()
    {
    alert(myframe.document.all.textbox2);
    myframe.location.href="3.html";
    alert(myframe.document.all.textbox3);
    }
    </script>
    </head><body>
    <input name="button" type="button" onclick="a()"/>
    <iframe src="2.html" id="myframe" width="500px" height="500px">
    </iframe>
    </body>
    </html>
    2.html:
    <body>
    2.html
    <input type="text" name="textbox2" />
    </body>
     
    3.html:
    <body>
    <p>3.html</p>
    <p>
      <input type="text" name="textbox3" />
    </p>
    </body>