首 页免费资源建站技术源码下载软件下载精品淘吧客户留言
用户登陆 | 用户注册
您当前的位置:笃志小屋建站技术网站开发Asp.net相关 → 文章内容
[ASP.NET]一个实用的弹出窗口函数
作者:佚名  来源:不详  发布时间:2008-7-3 14:12:18

public static void OpenPopUp(System.Web.UI.WebControls.WebControl opener,string PagePath,string windowName,int Top,int Left,int width,int height)
{
    string clientScript;
    string windowAttribs;
    windowAttribs = "left=" + Left.ToString() + "px," +
  "top=" + Top.ToString() + "px," +
  "width=" + width.ToString() + "px," + 
  "height=" + height.ToString() + "px," +
  "left=''''+((screen.width -" + width.ToString()+ ") / 2)+'''',";
  clientScript = "window.open(''''"+PagePath+ "'''',''''"+   
                                windowName + "'''',''''"+ windowAttribs + "'''');return false;";
    opener.Attributes.Add("onClick", clientScript);
}

private void Page_Load(object sender, System.EventArgs e)
{
    // 在此处放置用户代码以初始化页面
    if(!IsPostBack)
    {
 OpenPopUp(Button1,"http://www.google.com";);
 OpenPopUp(Button2,"http://www.google.com";,"",0,0,300,300);
    }
}

2008-7-3 14:12:18免费资源duzhi.net

[ ] [返回上一页] [打 印]

【笃志小屋duzhi.net】

  技术文章导航
  技术文章排行
  精彩推荐
Copyright www.duzhi.net All Right Reserved.
设计制作:翼迅设计室 Equick Desgin Home 在线QQ:303471038
网络备案号:冀ICP备06008201号 站长信箱:webmaster#duzhi.net(将#换为@)
本站部分文章和图片来源于网络和内容提供伙伴,如果侵犯了您的权利,请留言告知,本站定会及时删除相关文件!