开发者

Using javascript to open a popup window

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 wi开发者_如何学Gondow i can get the request.querystring but Im a little unsure of how the syntax is.


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 + "');");


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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜