请问如何在两个页面间传递参数 现在有两个页面A和B通过A在新窗口中打开了B,在B中选择了参数后关闭B并把参数填到A的某个textbox中,请问应该如何做啊?A是一直存在,不关闭的. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在a中用window.open()打开b页面然后就可以在b中用this.opener.form1.textbox1.value 来给a中的某个控件赋值 这个是用javascript实现的A页面<script>alert(window.showModalDialog("1.htm"));</script>B页面<script> function sendTo() { var a="123"; window.returnValue = a; } </script> <body> <form> <input value="返回" type=button onclick="sendTo()"> </form> 你试一试就知道 试了一下,其实我的B里面有一个.net自带的calendar控件,我想做到的是选择了日期后关闭窗口然后在A中显示,不过不知道为什么javascript运行不了,代码是这样的(只是个关闭窗口的代码) void Calendar1_SelectionChanged(Object sender, System.EventArgs e) { string getDate = Calendar1.SelectedDate.ToString("d") ; string strjscript = "<script language='javascript'>"; strjscript += " window.close()"; strjscript += "</" + "script" + ">"; } 不是,只是日历中随便一个日期而已,然后把这个日期返回到A中的某个<asp:textbox>中去 function doSelect(nameHolder, codeHolder) { if(window.opener != null) { //alert(document.all["seluser"].value); var obj = window.opener.document.getElementById(nameHolder); var objcode = window.opener.document.getElementById(codeHolder); if(obj != null && objcode != null) { obj.value = document.all["seluser"].value; objcode.value = document.all["seluserid"].value; window.close(); return; } } } robertlvqing,你那段是javascript的代码吧?那我的.net的日历控件怎么调用它呢? 问题解决了,晕,我犯了个非常低级的错误,script语句只用一个string装起来,但却没有response.write出来,晕自己一个 VisualSVN Server一个基本问题???在线等 LogFont不能使用? 如何用c#远程连接sql server2005,连接字符串怎么写? ADO 问题 说说看你们是如何做的:数据库字段属性的用于显示中文名称。 我编写的动态链接库怎么让别人不能反编译和调用啊? wpf DataGridComboBoxColumn 的问题 c#从网络读取验证码时出错 笨问题SQL字段类型为datetime 在C#使用什么类型匹配? 如何在WinForm或控制台项目中引用Windows.Media命名空间? 工程建立问题 用C#开发语音聊天主要用到什么知识点
然后就可以在b中用this.opener.form1.textbox1.value 来给a中的某个控件赋值
A页面
<script>
alert(window.showModalDialog("1.htm"));</script>B页面
<script>
function sendTo()
{
var a="123";
window.returnValue = a; }
</script>
<body>
<form>
<input value="返回" type=button onclick="sendTo()">
</form> 你试一试就知道
void Calendar1_SelectionChanged(Object sender, System.EventArgs e)
{
string getDate = Calendar1.SelectedDate.ToString("d") ;
string strjscript = "<script language='javascript'>";
strjscript += " window.close()";
strjscript += "</" + "script" + ">";
}
{
if(window.opener != null)
{
//alert(document.all["seluser"].value);
var obj = window.opener.document.getElementById(nameHolder);
var objcode = window.opener.document.getElementById(codeHolder);
if(obj != null && objcode != null)
{
obj.value = document.all["seluser"].value;
objcode.value = document.all["seluserid"].value;
window.close();
return;
}
}
}