html,子页面向父页面传递参数

来源:互联网 发布:专门听排箫的软件 编辑:程序博客网 时间:2024/06/07 02:20
父页面
<!DOCTYPE html><html>  <head>    <title>MyHtml.html</title>    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">    <meta http-equiv="description" content="this is my page">    <meta http-equiv="content-type" content="text/html; charset=UTF-8">        <!--<link rel="stylesheet" type="text/css" href="./styles.css">--><style type="text/css"></style>  </head>  <script type="text/javascript">  function aaa(){  window.open("index.jsp", 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no,resizable=no,location=no, status=no');  }  function bbb(content){  document.getElementById("test1").value = content;//赋值  }  </script>  <body>        <input id="test1" type="text"  >     <input type="button" value="提交" onclick="aaa()">   </body></html>
子页面
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>  <head>    <base href="<%=basePath%>">        <title>My JSP 'index.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0">     <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> -->  </head>  <script type="text/javascript">   function aaa(){    var str=document.getElementById("ddd").value;    alert(str);    window.opener.bbb(str);    window.close();   }  </script>  <body>    <input id="ddd" type="text"/>    <input type="button" value="提交" onclick="aaa()"/>  </body></html>


0 0