页面 1.htm 弹出窗体的页面
------------------------------------------------------------------
<script language="javascript">
function open_Dialog()
{
var title="模式窗口";
var url="2.htm";
var Width="800";
var Height="1000";
var return_Value;
if (document.all&&window.print)
{
return_Value = window.showModalDialog(url,window,"dialogWidth:" + Width + "px;dialogHeight:" + Height + "px;center:yes;status:no;scroll:yes;help:no;");
alert(return_Value);
}
else
window.open(url,"","width=" + Width + "px,height=" + Height + "px,resizable=1,scrollbars=1");
}
</script>
<body>
<form id="form1">
<input type="button" value="打开模式窗体" onclick="open_Dialog();">
</form>
</body>
-------------------------------------------------------------------
页面 2.htm 被弹出的页面
-------------------------------------------------------------------
<Script language="javascript">
function SetVal()
{
returnValue="qifei123";
}
</Script>
<html>
<head>
<base target="_self">
</head>
<body>
<form id="form1" action="1.htm">
<input type="button" value="设置返回值" onClick="SetVal();">
<input type="submit" value="提交">
<input type="button" value="关闭" onClick="window.close();">
</form>
<br>
<a href="http://www.baidu.com" target="_self">baidu</a>
<br><br>
当head中没有 <base target="_self"> 标记时,连接和表单中的 target="" 属性不管用,都是打开新窗口。
当head中存在 <base target="_self"> 标记时,连接和表单中有 target="" 属性不管值是什莫一概新弹出窗<br>口,
连接和表单中没有 target="" 属性时则在原窗口打开新页面。
</body>
</html>
------------------------------------------------------------------
------------------------------------------------------------------
<script language="javascript">
function open_Dialog()
{
var title="模式窗口";
var url="2.htm";
var Width="800";
var Height="1000";
var return_Value;
if (document.all&&window.print)
{
return_Value = window.showModalDialog(url,window,"dialogWidth:" + Width + "px;dialogHeight:" + Height + "px;center:yes;status:no;scroll:yes;help:no;");
alert(return_Value);
}
else
window.open(url,"","width=" + Width + "px,height=" + Height + "px,resizable=1,scrollbars=1");
}
</script>
<body>
<form id="form1">
<input type="button" value="打开模式窗体" onclick="open_Dialog();">
</form>
</body>
-------------------------------------------------------------------
页面 2.htm 被弹出的页面
-------------------------------------------------------------------
<Script language="javascript">
function SetVal()
{
returnValue="qifei123";
}
</Script>
<html>
<head>
<base target="_self">
</head>
<body>
<form id="form1" action="1.htm">
<input type="button" value="设置返回值" onClick="SetVal();">
<input type="submit" value="提交">
<input type="button" value="关闭" onClick="window.close();">
</form>
<br>
<a href="http://www.baidu.com" target="_self">baidu</a>
<br><br>
当head中没有 <base target="_self"> 标记时,连接和表单中的 target="" 属性不管用,都是打开新窗口。
当head中存在 <base target="_self"> 标记时,连接和表单中有 target="" 属性不管值是什莫一概新弹出窗<br>口,
连接和表单中没有 target="" 属性时则在原窗口打开新页面。
</body>
</html>
------------------------------------------------------------------