我是新手。请大家帮忙是这样。我有一列显示客户资料。我在边上做了个按钮,点击后出现一个客户的帮助框,可以查得客户资料。然后返回这个客户得内容。我该怎么实现呢。最好这个窗口不选择就不能返回。怎么样做呢
解决方案 »
- 求救啊:用户 'WCLIENT06\ASPNET' 登录失败
- 接口访问速度的问题
- 请教发布问题
- 急急急!请各位帮忙!如何保存数据!
- xsl问题,急
- 关于<input id="UpLoadFile" type="file" name="UpLoadFile" runat="server"> 的问题!!!
- 请高手帮帮我解决这个问题
- 哪位大哥提供一下:网站访问人数的代码(asp.net(vb.net)),让小弟学习一下,不甚感激!
- 哪位兄弟能提供清华--严蔚敏或者哈工大的数据结构本科上课的视频
- 不懂的问题!!!!
- 您没有调试该服务器的权限。验证您是服务器上"Debuger Users"组的成员。
- 本人专为研究和学习Duwamish 7.0建立了一个群,欢迎大家的加入
------------------------------
<!--Main.html-->
<script language="javascript">
function ShowWin()
{
window.showModalDialog("Help.html",window,"help:0;status:0");
}
</script>
<input id="txt_test" disabled="true">
<input id="btn_test" type="button" value="帮助" onclick="ShowWin();">
----------------------------------
<!--Help.html-->
<script language="javascript">
function GetMain()
{
if (document.all["txt_hlep"].value == "")
{
return;
}
dialogArguments.document.all["txt_test"].value = document.all["txt_hlep"].value;
window.close();
}
</script>
<input id="txt_hlep">
<input type="button" value="提交" id="btn_help" onclick="GetMain();">
function xx(){
xtp = new ActiveXobject("MSXML2.XMLHTTP");//创建对象
xtp.open("POST","aa.aspx?id=10",false);//设置为POST传输模式,并传输数据id=10
xtp.send("");
if (xtp.status == 200){//判断是否成功
aa = xtp.ResponseText;//这里的aa就是获取的值
}
}
</script>
那就用模式窗口吧..showModelDialog()
<script language='javascript'>
function selectCustom()
{
var returnValue=showModalDialog('CustomHelp.aspx',0,'dialogWidth:660px;dialogHeight:420px;status:no;help:no');"
}
document.all.custom.value=returnValue;
</script><input type="button" value="选择客户帮助" onclick="javascript:selectCustom()">
<input type="text" id="custom" name="custom">CustomHelp.aspx:
<script language='javascript'>
function reFun()
{
window.returnValue = 'xzq686';
window.close();
}
</script><input type="button" onclick="reFun()" value="点击返回值">
1.模态窗口的打开
2.模态窗口的关闭
3.模态窗口的传递参数。
4.其他。
1.window.showModalDialog("DialogPage.aspx","newwin","dialogHeight: 200px; dialogWidth: 150px; dialogTop: 458px; dialogLeft: 166px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;");2.window.close();3.传值
ParentPage.aspx:
window.showModalDialog("DialogPage.aspx?para1=aaa¶2=bbb");DialogPage.aspx:
string str1=Request.QueryString["para1"].toString();
string str2=Request.QueryString["para2"].toString();返回值
DialogPage.aspx:
window.returnValue="aaa";ParentPage.aspx:
var str=window.showModalDialog("DialogPage.aspx");4.
aspx页面在showmodeldialog情况下为什么一提交就重新打开一个页面?
showmodaldialog打开的页面中在<head></head>之间加入一行:<base target="_self">5.如果是在数据绑定的模式窗体中,还可以在DataGrid中创建一个模板列,再加入Html的按钮,在按钮中加入:
OnClick="returnValue='<%#DataBind.Eval(Container.DataItem,"Name")%>';window.close()"
就可以实现在模式对话框中传递DataGrid的具体选中的行的相关值。
6.例子
WebForm2.aspx.vb
Inherits System.Web.UI.Page
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents Button2 As System.Web.UI.WebControls.Button
Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Attributes.Add("onclick", "var st=window.showModalDialog('user.aspx?val='+document.all('TextBox1').value);document.all('TextBox1').value=st;return st;")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
RegisterStartupScript("key", "<script>window.opener=null;window.close(this);</script>")
End Sub
user.aspx.vb
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents cancel As System.Web.UI.WebControls.Button
Protected WithEvents ok As System.Web.UI.WebControls.Button
Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim str As String
If Not IsPostBack Then
str = Request.QueryString("val")
TextBox1.Text = str
End If
End Sub
Private Sub cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cancel.Click
RegisterStartupScript("key", "<script>window.returnValue='null';window.opener=null;window.close(this);</script>")
End Sub
Private Sub ok_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ok.Click
RegisterStartupScript("key", "<script>window.returnValue=document.all('TextBox2').value;window.opener=null;window.close(this);</script>")
End Sub