zoukankan      html  css  js  c++  java
  • window.ipener数据反填

    window.opener 返回的是创建当前窗口的那个窗口的引用,比如点击了a.htm上的一个链接而打开了b.htm,然后我们打算在b.htm上输入一个值然后赋予a.htm上的一个id为“name”的textbox中,就可以写为:


    window.opener.document.getElementById("name").value = "输入的数据";

    DEMO
    page1.html

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <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 openwin(url,wh,hg,lf,tp) {
      
    var newwin=window.open(url,"newwin","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width="+wh+",height="+hg+",left="+lf+",top="+tp);
      newwin.focus();
      
    return false;
    }


    function openwin1(url) {
      
    var newwin=window.open(url,"newwin","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes");
      newwin.focus();
      
    return false;
    }


    </script>
    </head>

    <body>
    <input name="name" type="text" />
    <input type="button" onClick="openwin1('page2.html')" value="abc" />
    </body>
    </html>


    page2.html

  • 相关阅读:
    idea jsp无法加载<c:foreach>循环遍历数据
    java POI读取Excel文件
    Javaweb中请求的资源[/Servlet]不可用解决方案
    大作业第一阶段冲刺(一)
    hive中sql左外连接查询列值为null
    关于ECharts在jsp页面无法显示的问题
    echarts通过ajax实现数据加载
    读书笔记
    解决:[Err] 1064
    idea启动Tomcat报错Artifact testdemo1:war exploded: Error during artifact deployment. See server log for details.问题解决
  • 原文地址:https://www.cnblogs.com/5tao/p/586656.html
Copyright © 2011-2022 走看看