test.php
<form name="form1" method="post" action="">
<a href="javascript:void(null)" class="add" onClick="open('demo.php','','resizable=1,scrollbars=1,status=no,toolbar=no,menu=no,width=500,height=400,left=150,top=50')">增加</a>
<input type="text" name="text1">
</form>
demo.php
<script language="javascript" type="text/javascript">
function returnValue()
{
window.opener.document.all.text1.value=document.getElementById("returnText").value;
window.close();
}
</script>
<p>
<input type="button" name="Submit" value="提交" onclick="returnValue();">
<input name="returnText" type="text" id="returnText">
</p>
补充:window.opener 的用法
window.opener 的用法在一般的用法中,只是用来解决关闭窗口时不提示弹出窗口,
而对它更深层的了解一般比较少。其 实 window.opener是指调用window.open方法的窗口。在工作中主要是用来解决部分提交的。这种跨页操作对工作是非常有帮助的。
如果你在主窗口打开了一个页面,并且希望主窗口刷新就用这个,打开页面的window.opener就相当于主窗口的window。
主窗口的刷新你可以用 window.opener.location.reload();
如果你要提交主窗口: 你可以改成这样 window.opener.yourformname.submit()
实例2:open
test.php
<script language="JavaScript">
var a = '';
window.open("test3.php");
function button1_onclick() {
alert(a);
}
</script>
<input type="button" id="button1" name="button1" value="Button" onclick="return button1_onclick()" />
test3.php
<script language="JavaScript">
function sendTo()
{
window.opener.a='test';
window.close();
}
</script>
<form id="form1" name="form1">
<input type="button" id="button1" name="button1" value="返回" onclick="sendTo()" />
</form>
实例3:showModalDialog
test.php
<!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=utf-8" />
<title>弹出窗口</title>
<script language="JavaScript">
function pop()
{
var arr = showModalDialog("test5.php", "", "dialogWidth:400; dialogHeight:400; status:0");
if (arr != null){
alert('您点击了:' + arr);
}
}
</script>
</head>
<body>
<div align="center"><input type="button" value="点我弹出窗口" onclick="pop()" /></div>
</body>
</html>
test5.php
<!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=utf-8" />
<title>弹出窗口</title>
<script>
function check(s){
window.returnValue = s;
window.opener=null;
window.close();
}
</script>
</head>
<body>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr align="center">
<td>点击链接:</td>
<td><a href="#" onclick="check('Share JavaScript')">Share JavaScript</a></td>
<td><a href="#" onclick="check('share.com')">share.com</a></td>
</tr>
</table>
</body>
</html>
分享到:
相关推荐
sharepoint 2010 弹出模式窗口showModalDialog并返回值
1> window.showModalDialog()采用JS原理实现,同时父窗口不可操作,window.open()采用新创建一个窗口,同时父窗口可操作; 2> 父窗口与子窗口传递值的方式也有所不同,在子窗口中操作父窗口也语法也不同,分别为var...
这里介绍了chooseCancelOnNextConfirmation、chooseOkOnNextConfirmation等JavaScript脚本实现的弹出窗口处理函数,selenium会弹出网页窗口,因为它重写了window.open在文件selenium-browserbot.js函数BrowserBot....
NULL 博文链接:https://hongan.iteye.com/blog/287050
newslist.asp的列表链接是用showModalDialog弹出窗口做的:...... 这样做就是用超链接把返回url转递到用showModalDialog打开的新窗口中,当showModalDialog返回时指到转来的url,最终不刷新父窗口。......
[removed]…function Pop() …{ var result=showModalDialog(‘downs.aspx’,’subpage’,’dialogWidth:400px;dialogHeight:300px;center:yes;help:no;resizable:no;status:no’); //打开模态子窗体,并获取返回值d
window.showModalDialog以及window.open用法简介 父子窗口传值
JS 弹出对话框window.showModalDialog,级联方式,可以返回传值给页面
习惯了Windows编程的小伙伴们往往对wingdows编程中的弹出窗口情有独钟。但是现在window.showmodalDialog()基本上属于被弃用的状态,蓝瘦香菇 目前用window.open()来代替,为此提供此实例,希望能帮助你们。
showModalDialog使用例子,父窗口向子窗口传递值,子窗口设置父窗口的值,子窗口关闭的时候返回值到父窗口 纯js 应用广泛 应用广泛
window.open()和window.showModalDialog(),并解决了showModalDialog()弹出窗口中列表分页的问题。 提供了三个JS方法: (1)showWindow(sURL, width, height); (2)showWindowInPage(pageUrl, params, title, ...
chrome中弹出模态对话框,通过window.returnValue赋返回值关闭后,有的情况下无法取得返回值。
使用window.showModalDialog的程序员都知道,该方法可返回值。但是如果遇到跨域时,就返回为underfine。本文档通过iframe镶嵌页面解决该问题。
window.showModalDialog&&open.docx
window.showModalDialog以及window.open用法简介
本篇文章主要是对js showModalDialog弹出窗口进行了详细的介绍,需要的朋友可以过来参考下,希望对大家有所帮助
针对window.showmodaldialog弹出窗体无刷新的详细使用
ShowModalDialog函数的功能: 使用方法: 参数说明:
showModalDialog和window.open