得到框架中对象的值

来源:互联网 发布:电脑怎么共享手机网络 编辑:程序博客网 时间:2024/06/06 04:47
<!-- 主页面 -->
<html>
  <head>
    <title>MyHtml.html</title>

    <meta http-equiv="keywords" c>
    <meta http-equiv="description" c>
    <meta http-equiv="content-type" c>
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
  </head>
  
  <body>
    <table>
     <tr>
      <td>
       <input type="text" name="txtResust"/><input type="button"  value="获得结果"/>
      </td>
      <td>
       <iframe src="1.html" id="iii" name="ifrm">
       </iframe>
      </td>
     </tr>
    </table>
  </body>
  
  <script language="javascript">
   function getResult()
   {
    var ifm = document.frames["ifrm"];
    document.write(ifm.txtUserName.value);
   }
  </script>
</html>

<!-- 框架 -->
<html>
  <head>
    <title>1.html</title>

    <meta http-equiv="keywords" c>
    <meta http-equiv="description" c>
    <meta http-equiv="content-type" c>
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
  </head>
  
  <body>
    <table>
     <tr>
      <td><input type="text" name="userName" id="txtUserName" value="aaaa"/></td>
      <td><input type="button" value="提交" /></td>
     </tr>
    </table>
  </body>
</html>