[ASP.NET] A practical pop-up window function
Source: Unknown Author: Unknown Recommended rating: Visits: 40
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," "(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) {/ / Place the user code here to initialize the page if (! Ispostback) {OpenPopup (Button1, "http://www.google.com";); OpenPopup (Button2, "http://www.google.com"; "" "" "" "", 0, 0, 300, 300);}}