var x = showModaldialog("x.htm")在 x.htm里,写window.returnValue="你选项的"即可参考 http://blog.csdn.net/net_lover/archive/2002/09/24/6910.aspx
var x=showModalDialog(1.html','window1','dialogWidth:300px;dialogHeight:250px;dialogLeft:200px;dialogTop:150px;center:yes;help:no;resizable:no;status:no');在弹出的窗口中选中姓名后,加一个确认事件 window.returnValue=下拉列表选中值; window.close();上面的x就得到值了
a.htm<script type="text/javascript"> window.onload = function(){ var d = showModalDialog('b.htm', 'dialogWidth:300px, dialogHeight:300px'); alert(d); } </script> b.htm<html> <head><script> window.onunload = function(){ var v = document.getElementById('t').value; returnValue = v; } </script> </head> <body> <input type="text" id="t" /> </body> </html>
http://blog.csdn.net/net_lover/archive/2002/09/24/6910.aspx
window.returnValue=下拉列表选中值;
window.close();上面的x就得到值了
window.onload = function(){
var d = showModalDialog('b.htm', 'dialogWidth:300px, dialogHeight:300px');
alert(d);
}
</script>
b.htm<html>
<head><script>
window.onunload = function(){
var v = document.getElementById('t').value;
returnValue = v;
}
</script>
</head>
<body>
<input type="text" id="t" />
</body>
</html>
<html>
<head><script>
function doSubmit(){
var v = document.getElementById('t');
returnValue = {number: v.value, uname: v.options[v.selectedIndex].text};
//返回js的object,有number、uname这2个属性
}
</script>
</head>
<body>
<select id="t">
<option value='123'>admin</option>
</select>
<input type="button" value="submit" onclick="doSubmit()"/>
</body>
</html><script type="text/javascript">
window.onload = function(){
var d = showModalDialog('b.htm', 'dialogWidth:300px, dialogHeight:300px');
alert(d.number+ "-"+ d.uname); //number、uname取这2个属性的值
}
</script>
前两天在测试safari浏览器的时候发现window.returnValue会导致safari出错,浏览器直接被关闭
document.getElementById('').value=somevalue;
//另外一个页面
window.returnValue="";
window.close();//也可以这样
var obj=new Object();
obj.name="";
obj.age=23;
window.showModalDialog('页面',obj,'');
//接收
window.dialogArguments