[ASP.NET]一个实用的弹出窗口函数

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 xujh 的 blog

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

本文关键:[ASP.NET]一个实用的弹出窗口函数
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top