富贵资源网 Design By www.hznty.com

a.html

<html> 
<head> 
<title>主页面</title> 
<script language="javascript" type="text/javascript"> 
function OpenNew() 
{ 
var im=new IDAndMethod(); 
im.ID=document.getElementById("txtID").value; 
window.showModalDialog("ddd.html",im,""); 
} 
function IDAndMethod() 
{ 
this.ID="ddd"; 
this.Method=SetTxt; 
} 
function SetTxt(str) 
{ 
document.getElementById("txtID").value=str; 
} 
</script> 
</head> 
<body> 
<form action="#"> 
<input id="txtID" style="width:400px" type="text" value="XXX!在这里输入ID!" /><br /> 
<input type="button" value="打开新的窗口" onclick="OpenNew()" /> 
</form> 
</body> 
</html>

 b.html

<html> 
<head> 
<title>主页面</title> 
<script language="javascript" type="text/javascript"> 
var im; 
function Load() 
{ 
im=window.dialogArguments; 
if(im.ID=="XXX!在这里输入ID") 
document.getElementById("txtID1").value="你杂不输入呢!"; 
else 
document.getElementById("txtID1").value=im.ID; 
} 
function Set() 
{ 
im.Method(document.getElementById("txtID1").value); 
} 
</script> 
</head> 
<body onload="Load()"> 
<form action="#"> 
<input id="txtID1" style="width:400px" type="text" value="ddd" /><br /> 
<input type="button" value="传递数据" onclick="Set()" /> 
</form> 
</body> 
</html>
富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com