showModalDialog()我看了以前的帖子还是不会用??怎样把参数互传?(对话框和原页面) http://www.csdn.net/develop/Read_Article.asp?Id=15113 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 index.htm<html><head><meta name="GENERATOR" content="Microsoft FrontPage 5.0"><meta name="ProgId" content="FrontPage.Editor.Document"><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>新建网页 1</title><script language>function show_time(){ document.form1.t1.value=window.showModalDialog("input_time.htm")}</script></head><body><form name="form1" method="POST" action=""> <p> <input type="text" name="t1" size="56"></p> <p><input type="button" value="点击输入日期和时间" name="B1" onClick="show_time()"></p></form></body></html>****************************input_time.htm(showModalDialog)<html><head><meta name="GENERATOR" content="Microsoft FrontPage 5.0"><meta name="ProgId" content="FrontPage.Editor.Document"><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>时间输入</title><script language="javascript">function okbutton(){ var now=new Date(); var hours=now.getHours(); var min=now.getMinutes(); window.returnValue=form1.t1.value+"-"+form1.t2.value+"-"+form1.t3.value+" 填写时间为 "+hours+":"+min; window.close();}function cancelbutton(){ window.returnValue="您没有填写完全"; window.close();}</script></head><body><form name="form1" method="POST" action=""> <input type="text" name="t1" size="20" value="">请输入年</p> <p> <input type="text" name="t2" size="20" value="">月</p> <p> <input type="text" name="t3" size="20" value="">日</p> <p align="center"> <input type="button" value="OK" name="B1" onClick="okbutton()"> <input type="button" value="Cancel" name="B2" onClick="cancelbutton()"></p></form></body></html> test.html<HTML><BODY><input type="text" id="txt" size=20><script>function show(){x = showModalDialog("testnew.html",window,"dialogWidth:400px;dialogHeight:300px;status:no;");txt.value = x;}</script><input type=button value=open onclick="show()"></BODY></HTML>testnew.html------------------------<HTML><BODY><input type="text" name="dlgtxt"><button onclick="doSomething()">do somthing</button><SCRIPT>MyText="A Popup Example"</SCRIPT><script>function doSomething(){ returnValue = dlgtxt.value; close();}</script></BODY></HTML> var k; var s = new Object(); var bqnr s.bqnr = formEdit.bqnr.value; s.bqxh = formEdit.bqxh.value; var url if(formEdit.bqxh.value=="") {url="grbq_edit.asp";} else {url="grbq_edit.asp?bqxh=" + formEdit.bqxh.value;} k=showModalDialog(url,s,"dialogWidth:298px;status:no;dialogHeight:398px"); 传的是对象怎么办? 试试这段代码<script>var vDialog=null;function rdl_doDialog(){vDialog=showModelessDialog("rdl_showmodelessdialog_demo.html",window,"status:no;resizable:yes;dialogHeight:210px;dialogWidth:360px;unadorne:yes");}function rdl_setDialogValue(){if (vDialog != null) vDialog.idDialogInput.value=idOpenerInput.value;}</script><input type=text id=idOpenerInput value="传递的文字"><br><br><input type=button onclick="rdl_doDialog();" value="建立对话框"><input type=button onclick="rdl_setDialogValue();" value="传递文字">---- 对话框页面的代码 ----<script>function window.onunload() {dialogArguments.vDialog=null;}</script><input type=text id=idDialogInput><br><br><input type=button onclick="dialogArguments.idOpenerInput.value=idDialogInput.value;" value="传递文字"><input type=button onclick="window.close();" value="关闭"> RSS 阅读器 跨域问题 JS 动态添加事件 我怎么学习JavaScript好呢.... 我按MS的例子做的,没有做出电子表的效果出来呀? 百分求一思路在线等高手来 如何用JS禁用IE浏览器的打印功能? dullwolf(超级大笨狼) 对"点击页面出现文本框"的回复,我想生成下拉框 如何通过按钮动态改变iframe的高度? 表格中的TextBox的焦点问题。 正则解析姓名:某某 姓名:某某 姓名某某 获取具体值如何实现 关于window.open <input name="id[0].id" value="myname" /> 里面的值如何得到?
<html><head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
<script language>
function show_time(){
document.form1.t1.value=window.showModalDialog("input_time.htm")
}
</script>
</head><body><form name="form1" method="POST" action="">
<p>
<input type="text" name="t1" size="56"></p>
<p><input type="button" value="点击输入日期和时间" name="B1" onClick="show_time()"></p>
</form></body></html>
****************************
input_time.htm(showModalDialog)<html><head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>时间输入</title>
<script language="javascript">
function okbutton(){
var now=new Date();
var hours=now.getHours();
var min=now.getMinutes();
window.returnValue=form1.t1.value+"-"+form1.t2.value+"-"+form1.t3.value+" 填写时间为 "+hours+":"+min;
window.close();
}
function cancelbutton(){
window.returnValue="您没有填写完全";
window.close();
}</script>
</head><body><form name="form1" method="POST" action="">
<input type="text" name="t1" size="20" value="">请输入年</p>
<p>
<input type="text" name="t2" size="20" value="">月</p>
<p>
<input type="text" name="t3" size="20" value="">日</p>
<p align="center">
<input type="button" value="OK" name="B1" onClick="okbutton()">
<input type="button" value="Cancel" name="B2" onClick="cancelbutton()"></p>
</form></body></html>
<HTML><BODY>
<input type="text" id="txt" size=20>
<script>
function show(){
x = showModalDialog("testnew.html",window,"dialogWidth:400px;dialogHeight:300px;status:no;");
txt.value = x;
}
</script>
<input type=button value=open onclick="show()">
</BODY></HTML>testnew.html------------------------
<HTML><BODY>
<input type="text" name="dlgtxt">
<button onclick="doSomething()">do somthing</button>
<SCRIPT>MyText="A Popup Example"</SCRIPT>
<script>
function doSomething(){
returnValue = dlgtxt.value;
close();
}
</script>
</BODY></HTML>
var s = new Object();
var bqnr
s.bqnr = formEdit.bqnr.value;
s.bqxh = formEdit.bqxh.value;
var url
if(formEdit.bqxh.value=="")
{url="grbq_edit.asp";}
else
{url="grbq_edit.asp?bqxh=" + formEdit.bqxh.value;}
k=showModalDialog(url,s,"dialogWidth:298px;status:no;dialogHeight:398px");
传的是对象怎么办?
var vDialog=null;
function rdl_doDialog(){
vDialog=showModelessDialog("rdl_showmodelessdialog_demo.html",window,"status:no;resizable:yes;dialogHeight:210px;dialogWidth:360px;unadorne:yes");
}
function rdl_setDialogValue(){
if (vDialog != null) vDialog.idDialogInput.value=idOpenerInput.value;
}
</script>
<input type=text id=idOpenerInput value="传递的文字"><br><br>
<input type=button onclick="rdl_doDialog();" value="建立对话框">
<input type=button onclick="rdl_setDialogValue();" value="传递文字">
---- 对话框页面的代码 ----<script>
function window.onunload() {
dialogArguments.vDialog=null;
}
</script><input type=text id=idDialogInput><br><br>
<input type=button onclick="dialogArguments.idOpenerInput.value=idDialogInput.value;" value="传递文字">
<input type=button onclick="window.close();" value="关闭">