javascript页面间进行传值(弹出对话框形式)
2008-11-20 17:35
295 查看
test1.aspx页面的listbox的值,传到test2.aspx的textbox中
test1.aspx页面代码
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<script type="text/javascript">
function openChild()
{
var k = window.showModalDialog ("../test2.aspx",window, "dialogWidth:395px;status:no;dialogHeight:495px");
}
</script>
<asp:ListBox ID="lstSjr" runat="server">
<asp:ListItem Selected="True" Value="abc"></asp:ListItem>
<asp:ListItem Value="cc"></asp:ListItem>
</asp:ListBox>
<input id="Button2" type="button" onclick="openChild()" value="button" />
</div>
</form>
</body>
</html>
test2.aspx页面代码
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test2.aspx.cs" Inherits="test2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="txtSxr" type="text" />
<script language="javascript" type="text/javascript">
var k = window.dialogArguments;
document.getElementById("txtSxr").value = k.document.getElementById("lstSjr").value;
</script>
</div>
</form>
</body>
</html>
test1.aspx页面代码
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<script type="text/javascript">
function openChild()
{
var k = window.showModalDialog ("../test2.aspx",window, "dialogWidth:395px;status:no;dialogHeight:495px");
}
</script>
<asp:ListBox ID="lstSjr" runat="server">
<asp:ListItem Selected="True" Value="abc"></asp:ListItem>
<asp:ListItem Value="cc"></asp:ListItem>
</asp:ListBox>
<input id="Button2" type="button" onclick="openChild()" value="button" />
</div>
</form>
</body>
</html>
test2.aspx页面代码
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test2.aspx.cs" Inherits="test2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="txtSxr" type="text" />
<script language="javascript" type="text/javascript">
var k = window.dialogArguments;
document.getElementById("txtSxr").value = k.document.getElementById("lstSjr").value;
</script>
</div>
</form>
</body>
</html>
相关文章推荐
- 解决:在用户安装”未知来源“应用弹出对话框直接解除禁止,无需切换至设置页面进行勾选“未知来源“才能安装
- 实现Javascript退出页面弹出对话框
- [收藏]用JavaScript让弹出页面以最小化的形式出现在状态栏中
- Javascript弹出对话框 确定取消转到不同页面
- 解决:在用户安装”未知来源“应用弹出对话框直接解除禁止,无需切换至设置页面进行勾选“未知来源“才能安装
- javascript弹出对话框的几种形式
- 修复弹出JavaScript对话框时页面背景变白的问题
- javascript实现页面弹出对话框,点确定再跳转到其他页面的方法
- javascript 实现页面弹出对话框
- 实现弹出"提示对话框"之后再进行"页面的转向"
- Javascript弹出对话框 确定取消转到不同页面
- javascript弹出对话框的几种形式
- javascript form 验证函数 弹出对话框形式
- javascript弹出对话框的几种形式
- 自己整理得一个JavaScript写的一个DIV 弹出网页对话框
- JavaScript写的一个DIV 弹出网页对话框
- tabhost (activitygroup)中子页面弹出对话框
- javascript入门·三种弹出对话框的用法实例
- ASP.NET弹出对话框并跳转页面
- JavaScript页面刷新与弹出窗口问题解决方法