弹出框 子页面值返回父页面
来源:互联网 发布:微课编辑软件 编辑:程序博客网 时间:2024/05/21 10:02
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>parent.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">-->
<script type="text/javascript">
function openWin() {
var style = "width=300,height=400,location=no,directories=no,toolbar=no,status=no,menubar=no,resizable=no,scrollbars=no";
window.open("2.html","newwindow",style);
}
function setValue(name,hname) {
document.getElementById("name").value = name;
document.getElementById("hname").value = hname;
}
</script>
</head>
<body>
name:<input type="text" id="name"/><a href="#" onclick="openWin()">xuanze</a>
<input type="hidden" name="name" id="hname"/>
</body>
</html>
2
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>child.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">-->
<script type="text/javascript">
function selectedThis(obj) {
var name = obj.value;
var hname = obj.id;
window.opener.setValue(name,hname);//调用父窗口的方法进行传值
window.opener = null; //我认为是给了window.opener赋一个值,让它变成了一个OBJECT.因为,opener存在的时候用 //JS关闭它是不需要确认的。所以,这行语句一般 用于window.close();前。
window.open('','_self');
window.close();
}
</script>
</head>
<body>
nameSelect:<br/>
<input type="radio" name="name" id="name1" value="name1" onclick="selectedThis(this)"/>name1
<input type="radio" name="name" id="name2" value="name2" onclick="selectedThis(this)"/>name2
<input type="radio" name="name" id="name3" value="name3" onclick="selectedThis(this)"/>name3
</body>
</html>
11
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<script language="javascript">
<!--
function openChild(){
var k = window.showModalDialog("22.html","window","dialogWidth:335px;status:no;dialogHeight:300px");
if(k != null)
document.getElementById("txt11").value = k;
}
//-->
</script>
</HEAD>
<BODY>
<br>传递到父窗口的值:<input id="txt9" type="text" value="3333333333333"><br>
返回的值:<input id="txt11" type="text"><br>
子窗口设置的值:<input id="txt10" type="text"><br>
<input type ="button" value="openChild" onclick="openChild()">
</BODY>
</HTML>
22
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache">
<meta http-equiv="Pragma" CONTENT="no-cache">
</HEAD>
<BODY>
<br>父窗口传递来的值:<input id="txt0" type="text"><br>
输入要设置父窗口的值:<input id="txt1" type="text"><input type ="button" value="设置父窗口的值" onclick="setFather()"><br>
输入返回的值:<input id="txt2" type="text"><input type ="button" value="关闭切返回值" onclick="retrunValue()">
<input type ="button" value="关闭刷新父窗口" onclick="">
</BODY>
</HTML>
<script language=javascript>
<!--
var k=window.dialogArguments;
//获得父窗口传递来的值
if(k!=null)
{
document.getElementById("txt0").value = k.document.getElementById("txt9").value;
}
//设置父窗口的值
function setFather()
{
k.document.getElementById("txt10").value = document.getElementById("txt1").value
}
//设置返回到父窗口的值
function retrunValue()
{
var s = document.getElementById("txt2").value;
window.returnValue=s;
window.close();
}
//-->
</script>
- 弹出框 子页面值返回父页面
- js弹出子页面并将值返回父页面
- 页面弹出框返回值
- 页面弹出框返回值
- 弹出页面返回值
- Js弹出页面,关闭页面返回值
- js弹出页面返回值
- 当前页面弹出子页面,在子页面关闭时将子页面的值带到父页面中
- JS父页面获取子页面返回值
- js将子页面的值返回给父页面
- JS 父页面接收子页面返回值
- window.showModalDialog子页面向父页面返回值
- 弹出子修改页面
- 点击弹出子页面GridView,双击选值后返回
- 弹出窗口并向父页面返回值
- 父页面打开两级模式窗口,子页面无法向父页面返回值
- 弹出页面 和返回目页面的值
- asp.net 弹出子页面 锁定父页面
- 在SQL Server2005中更改sa用户密码
- 记阿里巴巴一面
- JAVA断言使用
- 看arm linux mm的一些总结和问题
- Qt: OpenGL模板
- 弹出框 子页面值返回父页面
- UILabel顶端对齐
- Chapter 7.顺序容器list
- Qt Creator快捷键
- python之文件操作
- git版本控制系统和github的初级使用
- Java_命令行
- Tomcat – java.security.AccessControlException: access denied (logging.properties read)
- Window_Open详解