总共有三个aspx页:
page1.aspx:<%@ Page Language="VB" Debug="true" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><script runat="server">
Sub page_load()
Dim strScript As String = "<script language=javascript> function openwin(){" + vbCrLf
strScript += "var str=window.ShowModalDialog('page2.aspx',form1.textbox1.value)" + vbCrLf
strScript += "if ( str!=null) form1.textbox1.value=str" + vbCrLf
strScript += "} " + vbCrLf
strScript += "<"
strScript += "/script>" + vbCrLf
If (Not IsClientScriptBlockRegistered("clientScript")) Then
RegisterClientScriptBlock("clientScript", strScript)
End If
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>窗口间传值测试</title>
</head>
<body>
<form id="form1" runat="server" method="post">
<asp:Label ID="bll" Runat="server">暂时</asp:Label><br />
<asp:Label ID="label1" runat="server" Font-Bold="true">从当前页面打开新窗口,并把变量传递到新窗口的例子,可以多次打开提交</asp:Label><br />
<asp:TextBox ID="textbox1" Runat="server" Width="600px">这是初始值,将被传递到新窗口。</asp:TextBox><br />
<asp:Button ID="button1" Runat="server" Text="打开窗口" Width="96px"/>
</form>
</body>
</html>
page1.aspx:<%@ Page Language="VB" Debug="true" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><script runat="server">
Sub page_load()
Dim strScript As String = "<script language=javascript> function openwin(){" + vbCrLf
strScript += "var str=window.ShowModalDialog('page2.aspx',form1.textbox1.value)" + vbCrLf
strScript += "if ( str!=null) form1.textbox1.value=str" + vbCrLf
strScript += "} " + vbCrLf
strScript += "<"
strScript += "/script>" + vbCrLf
If (Not IsClientScriptBlockRegistered("clientScript")) Then
RegisterClientScriptBlock("clientScript", strScript)
End If
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>窗口间传值测试</title>
</head>
<body>
<form id="form1" runat="server" method="post">
<asp:Label ID="bll" Runat="server">暂时</asp:Label><br />
<asp:Label ID="label1" runat="server" Font-Bold="true">从当前页面打开新窗口,并把变量传递到新窗口的例子,可以多次打开提交</asp:Label><br />
<asp:TextBox ID="textbox1" Runat="server" Width="600px">这是初始值,将被传递到新窗口。</asp:TextBox><br />
<asp:Button ID="button1" Runat="server" Text="打开窗口" Width="96px"/>
</form>
</body>
</html>
解决方案 »
- 关于.net 页面刷新之后,本来居中的div层变化,不再居中的问题。
- 大家帮我读读这段程序啊,如何将html转为pdf的时候分页?(提供html转pdf的好办法啊大家来看看~)
- tabao File System 这个文件系统,有用过的朋友吗
- 求一正则表达式
- ASP.NET网站发布的问题-无法反问数据库
- 在.net中的递归怎么写呀
- 关于动态控件事件无法触发问题???
- 高手们分析一下下面的错误信息,该如何解决啊!
- ===>典型的多层开发中关于数据库记录到实体映射的问题
- 为什么我的按钮没反应
- vs.net中的microsoft application center test软件是做什么用的
- datagrid的ItemDataBound事件中DataRowView drv = (DataRowView)e.Item.DataItem;为什么转换无效呢
<%@ Page Language="VB" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><script runat="server"></script><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head> <frameset rows="0,*">
<frame src="about:blank" />
<frame src="page3.aspx" />
</frameset>
</html>
<%@ Page Language="VB" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><script runat="server">
Sub page_load()
If IsPostBack Then
Dim strscript As String = "<script>" & vbCrLf
strscript &= "window.parent.returnvalue='" & textbox1.Text.Replace("'", "\'") & "'" & vbCrLf
strscript &= "window.parent.close() <" + vbCrLf
strscript &= "/script>" & vbcrlf
If Not IsClientScriptBlockRegistered("clientScript") Then
RegisterClientScriptBlock("clientscript", strscript)
End If
End If
If Not IsPostBack Then
mybody.attributes.add("unload", "document.form1.textbox1.value=window.parent.dialogarguments")
End If
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body id="mybody" runat="server">
<form id="form1" runat="server">
<div>
<asp:Label ID="label1" Runat="server">Please Input Your Name Here:</asp:Label>
<br />
<asp:TextBox ID="textbox1" Runat="server" Width="258"></asp:TextBox>
<br />
<asp:Button ID="button1" Runat="server" Text="Submit" />
</div>
</form>
</body>
</html>
看得头晕~~2005写成这样也算极品了吧?哈哈哈哈
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
窗口间传值测试
</title></head>
<body>
<form method="post" action="page1.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" value="/wEPDwUKMTM1MTY5NDg4NWRk1iT9W6DhVWz1/zh8nS2urLtBnfk=" />
</div><script language=javascript> function openwin(){
var str=window.ShowModalDialog('page2.aspx',form1.textbox1.value)
if ( str!=null) form1.textbox1.value=str
}
</script> <div>
<span id="label1" style="font-weight:bold;">从当前页面打开新窗口,并把变量传递到新窗口的例子,可以多次打开提交</span><br />
<input name="textbox1" type="text" value="这是初始值,将被传递到新窗口。" id="textbox1" style="width:600px;" /><br />
<input type="submit" name="button1" value="打开窗口" id="button1" style="width:96px;" />
</div>
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >去掉看看
<%@ Page Language="VB" Debug="true" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><script runat="server">
Sub page_load()
If (Not IsClientScriptBlockRegistered("clientScript")) Then
Dim strScript As String = "<script>" + vbCrLf
strScript += "function OpenWin(){" + vbCrLf
strScript += "var str=window.showModalDialog('page2.aspx',document.getElementById('textbox1').value)" + vbCrLf
strScript += "if(str!=undefined) document.getElementById('textbox1').value=str" + vbCrLf
strScript += "}" + vbCrLf
strScript += "<"
strScript += "/script>" + vbCrLf
RegisterClientScriptBlock("clientScript", strScript)
End If
button1.Attributes.Add("onclick", "OpenWin()") End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>窗口间传值测试</title>
</head>
<body>
<form id="form1" runat="server" method="post">
<asp:Label ID="bll" Runat="server">暂时</asp:Label><br />
<asp:Label ID="label1" runat="server" Font-Bold="true">从当前页面打开新窗口,并把变量传递到新窗口的例子,可以多次打开提交</asp:Label><br />
<asp:TextBox ID="textbox1" Runat="server" Width="600px">这是初始值,将被传递到新窗口。</asp:TextBox><br />
<asp:Button ID="button1" Runat="server" Text="打开窗口" Width="96px"/>
<input type=button value=open onclick="javascript:OpenWin();" />
</form>
</body>
</html>
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head> <frameset rows="0,*">
<frame src="about:blank" />
<frame src="page3.aspx" />
</frameset>
</html>
Sub page_load()
If IsPostBack Then
Dim strScript As String = "<script>" + vbCrLf
strScript += "window.parent.returnValue='" + textbox1.Text.Replace("'", "\'") + "'" + vbCrLf
strScript += "window.parent.close() " + vbCrLf
strScript += "<"
strScript += "/script>" + vbCrLf
If (Not IsClientScriptBlockRegistered("clientScript")) Then
RegisterClientScriptBlock("clientScript", strScript)
End If
End If
If Not IsPostBack Then
mybody.Attributes.Add("onload", "form1.textbox1.value=window.dialogArguments")
End If End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body id="mybody" runat="server">
<form id="form1" runat="server">
<div>
<asp:Label ID="label1" Runat="server">Please Input Your Name Here:</asp:Label>
<br />
<asp:TextBox ID="textbox1" Runat="server" Width="258"></asp:TextBox>
<br />
<asp:Button ID="button1" Runat="server" Text="Submit" />
</div>
</form>
</body>
</html>