使用javascript的弹出窗口 [英] popup window using javascript

查看:66
本文介绍了使用javascript的弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我试图使用javascript在单击按钮时查看弹出窗口.但是由于以下代码Iam无法获得弹出窗口,它只是打开了另一个页面.是否可以修改此代码并获得弹出窗口?

代码在这里:-

Hi,
Iam trying to view a popup window while clicking on a button, using javascript.But with the following code Iam unable to get a popup window,it just open up another page.Is it possible to modify this code and obtain a popup window?

Code here:-

<%@ Page Language="C#" %>


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


    <script runat="server">


        protected void Button1_Click(object sender, EventArgs e)
        {

            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "popup", "window.open('http://localhost:49911/UI/Report1.aspx','width=100,height=100,scrollbars=no');", true);
        }
    </script>


    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title></title>


        <script type="text/javascript">


            function pageLoad() {
            }


        </script>


    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
        </div>


        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
        </form>
    </body>
    </html>





请帮助.





please Help.

推荐答案

尝试以下代码
ScriptManager.RegisterStartupScript(Page,Page.GetType(),"popup","window.open(''http://localhost:49911/UI/Report1.aspx'',''_ blank'',''width = 100 ,height = 100,scrollbars = no'');,true);
Try the following code
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "popup", "window.open(''http://localhost:49911/UI/Report1.aspx'',''_blank'',''width=100,height=100,scrollbars=no'');", true);


这篇关于使用javascript的弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆