showModalDialog返回数组
来源:互联网 发布:淘宝不买东西怎么投诉 编辑:程序博客网 时间:2024/06/07 13:04
自己对js可真是不熟悉啊。一个返回数组问题居然难了我一个下午,为了防止再次忘记 还是把它写下来吧。
页面Default.aspx代码如下
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<script language="javascript" type="text/javascript">
function DispModelDialog()
{
var a=new Array(3);
a= showModalDialog("Default2.aspx",a,"status:no;Help:no;resizable:yes");
document.form1.TextBox1.value=a[0];
document.form1.TextBox2.value=a[1];
document.form1.TextBox3.value=a[2];
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td style="width: 100px">
姓名:</td>
<td style="width: 100px">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td>
<td style="width: 100px">
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="DispModelDialog();" /></td>
</tr>
<tr>
<td style="width: 100px">
类型:</td>
<td style="width: 100px">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></td>
<td style="width: 100px">
</td>
</tr>
<tr>
<td style="width: 100px">
号码:</td>
<td style="width: 100px">
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox></td>
<td style="width: 100px">
</td>
</tr>
</table>
</div>
<input id="Button2" type="button" value="button" onclick="DispModelDialog();" />
</form>
</body>
</html>
Default2.aspx
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title><base target="_self" />
<script language="javascript" type="text/javascript">
var name="123";
function funGetInfo()
{
var sDate=new Array(3);
sDate[0]=document.form1.TextBox1.value;
sDate[1]=document.form1.TextBox2.value;
sDate[2]=document.form1.TextBox3.value;
window.returnValue= sDate;
window.close();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<input id="Text1" type="text" />
<input id="Button2" type="button" value="button" onclick="funGetInfo();"/>
</form>
</body>
</html>
可以在服务器端输出javascript比如在一个包含gridview的页面上,你过你需要选择一行数据中的3个值返回
你就可以这样写了
Response.Write("<script language=javascript> var s=Array(3);s[0]='"+this.GridView1.SelectedRow.Cells[0].Text+"';"+
"s[1]='"+this.GridView1.SelectedRow.Cells[1].Text+"';s[2]='"+this.GridView1.SelectedRow.Cells[2].Text+"';window.returnValue=s;window.close();</script>");
其实很简单,不过网上写的这么详细的很少啊。
- 利用showmodalDialog返回数组
- showModalDialog返回数组
- Js弹出showModalDialog窗口---返回值或数组
- showModalDialog 返回值
- window.showModalDialog返回值
- showModalDialog的返回值
- window.showModalDialog的返回值
- 获取showModalDialog窗口返回值
- window.showModalDialog()之返回值
- window.showModalDialog()之返回值
- 跨域 showModalDialog 获取返回值
- window.showModalDialog方法返回值为对象,若Dialog窗口中返回的对象为数组,会丢失数组构造信息,不能对返回值使用Array方法。
- 利用 window.showModalDialog 一次返回多个值
- window.showModalDialog()弹出窗口获取返回值
- showModalDialog得到返回值的用法
- 获取showModalDialog()的不同返回值
- JS window.showModalDialog() 模式对话框返回值
- 关于window.showModalDialog()返回值的学习心得
- 与人交往27技!
- flash8的mx.data.binding.EndPoint
- ASP.NET(用c#),弹出文件保存对话框窗口
- JavaBean的作用范围
- tomcat 读取 .properties 文件的问题
- showModalDialog返回数组
- CSS基础篇
- css使用编
- jspSmartUpload上传下载全攻略
- struts 的路径问题
- 使用 Ajax Toolkit Framework 开发 Dojo 应用
- css属性编(一)
- Tomcat5.x中的虚拟主机配置方法
- Web服务搜索与执行引擎(七)——重温WSDL与SOAP