您的位置:首页 > Web前端 > JavaScript

javascript如何在两个窗口之间返回值

2007-11-01 16:45 113 查看
1.此问题涉及到两个页面

1.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function closewindow(){
window.returnValue="1234";
window.close();
}
</script>
</head>

<body>
<input type="button" name="button1" value="关闭" onclick="closewindow()" />
</body>
</html>

2.html

<!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="">
<script language="javascript">
function openwindow(){
var b=window.showModalDialog( "1.html ","", "dialogWidth:400;dialogHeight:500 ");
alert(b);//此地方的值返回的是1234
}
</script>
</HEAD>

<BODY>
<input type="button" name="button" value="打开" onclick="javascript:openwindow();"/>
</BODY>
</HTML>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: