使用javascript打开弹出窗口

发布于 2024-08-26 20:54:16 字数 582 浏览 4 评论 0 原文

我想在我的 c#.net 应用程序中使用 javascript 打开一个弹出窗口。这是我的网络表单中正文标记中的代码,

<script language=javascript>
    function openWindow(strEmail)
    {        
    window.open('CheckEmail.aspx?email=' + strEmail + , 'Check Email','left=100,top=100,toolbar=no,scrollbars=yes,width=680,height=350');
    return false;
    }
</script>

这是我在 Page_Load 部分中的代码,

this.btnCheck.Attributes.Add("onclick", "return openWindow(" + txtEmail.Text + ");");

现在我正在尝试从文本框“txtEmail”传递字符串,因此在我的弹出窗口中我可以获取 request.querystring 但我是不太确定语法是怎样的。

I would like to open a popup window using javascript in my c#.net app. This is the code in the body tag in my webform

<script language=javascript>
    function openWindow(strEmail)
    {        
    window.open('CheckEmail.aspx?email=' + strEmail + , 'Check Email','left=100,top=100,toolbar=no,scrollbars=yes,width=680,height=350');
    return false;
    }
</script>

this is my code in the Page_Load section

this.btnCheck.Attributes.Add("onclick", "return openWindow(" + txtEmail.Text + ");");

right now I'm trying to pass the string from my textbox "txtEmail" so in my popup window i can get the request.querystring but Im a little unsure of how the syntax is.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

青衫负雪 2024-09-02 20:54:16

不需要最后一个 +

window.open('CheckEmail.aspx?email=' + strEmail,'Check Email','left=100,top=100,toolbar=no,scrollbars=yes,width=680,height=350');

获取查询字符串

Request.QueryString["email"]

,在 CheckEmail.aspx 页面中,您可以在 textEmail.Text 周围的函数内的 CS 端使用 Use a '

this.btnCheck.Attributes.Add("onclick", "return openWindow('" + txtEmail.Text + "');");

No need of the last +

window.open('CheckEmail.aspx?email=' + strEmail,'Check Email','left=100,top=100,toolbar=no,scrollbars=yes,width=680,height=350');

and in CheckEmail.aspx page you can get the query string as

Request.QueryString["email"]

Use a ' in the CS side inside the function around the textEmail.Text

this.btnCheck.Attributes.Add("onclick", "return openWindow('" + txtEmail.Text + "');");
冷情妓 2024-09-02 20:54:16

如果 txtEmail 控件可见,为什么不在客户端代码中获取电子邮件。

function openWindow()
{  
   var email = document.getElementById('<%=txtEmail.ClientID%>').value;
   window.open('CheckEmail.aspx?email=' + email + , 'Check Email','left=100,top=100,toolbar=no,scrollbars=yes,width=680,height=350');
   return false;
}

Why don't you get the email in the client code if the txtEmail control is visible.

function openWindow()
{  
   var email = document.getElementById('<%=txtEmail.ClientID%>').value;
   window.open('CheckEmail.aspx?email=' + email + , 'Check Email','left=100,top=100,toolbar=no,scrollbars=yes,width=680,height=350');
   return false;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文