Posted on 2009-09-24 14:23
love1563 阅读(1382)
评论(0) 编辑 收藏 所属分类:
Java语言*初级版
http://blog.csdn.net/yemy/archive/2006/10/25/1351413.aspx
父页面
<html>
<head>
<title>无标题页</title>
<script language="javascript" type="text/javascript">
function opendialog1()
{
var someValue=window.showModalDialog("b.html","","dialogWidth=500px;dialogHeight=500px;status=no;help=no;scrollbars=no");
document.form1.p1t.value=someValue;
}
</script>
</head>
<body>
<form name="form1" action="#">
<input type="text" name="p1t">
<input type="button" value="打开对话框" onclick="opendialog1()">
</form>
</body>
</html>
子页面
<html>
<head>
<title>无标题页</title>
<script language="javascript" type="text/javascript">
function a(wname)
{
parent.window.returnValue=wname; //父窗口就是上一个页面
window.close();
}
</script>
</head>
<body>
<form name="form1" action="">
<input type="button" value="传值" onclick="return a('hello')">
</form>
</body>
</html>
<HTML>
<HEAD>
<TITLE> 子页面 </TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function getValue(str){
window.opener.document.getElementById("text1").value=str;
window.close();
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<A href="" onclick="getValue('超联接1')">超联接1</A>
<A href="" onclick="getValue('超联接2')">超联接2</A>
<A href="" onclick="getValue('超联接3')">超联接3</A>
<A href="" onclick="getValue('超联接4')">超联接4</A>
</BODY>
</HTML>