asp.net background How to output the JS script, implemented in Page.ClientScript.RegisterStartupScript mode, implementation, such as below, interested friends don't miss
With page. Clientscript.registerstartupscript Mode implementation code for: code as follows:/**////<summary> /// Pop-up JavaScript small window ///</summary> ///<param name= "JS" > Window information </param> public static void Alert (String message, page page) { #region String js = @ "<script language= ' JavaScript ' >  ; Alert (' + message + ');</script> "; //httpcontext.current.response.write (JS); if (!page. Clientscript.isstartupscriptregistered (page. GetType (), "alert") { page. Clientscript.registerstartupscript (page. GetType (), "alert", JS); } #endregion } /**////<summary> ///popup message box and move to the new URL ///</summary> ///<param name= "messages" > Message content </param> ///<param name= "Tourl" > Connection address </param> public static void Alertandredirect (String message, String tourl, page page) { # region string js = "<script Language=javascript>aleRT (' {0} '); Window.location.replace (' {1} ') </script> "; //httpcontext.current.response.write (String. Format (JS, message, Tourl)); if (!page). Clientscript.isstartupscriptregistered (page. GetType (), "Alertandredirect")) { page. Clientscript.registerstartupscript (page. GetType (), "Alertandredirect", String. Format (JS, message, Tourl)); } #endregion } /**////<summary> ///back to History page ///</summary> ///<param name= "value" >-1/1</param> public static void Gohistory ( int value, page page) { #region String js = @ "<script language= ' JavaScript ' > history.go ({0} ); </Script> "; //httpcontext.current.response.write (String. Format (JS, value)); if (!page. Clientscript.isstartupscriptregistered (page. GetType (), "Gohistory")) { page. Clientscript.registerstartupscript (page. GetType (), "Gohistory", String. Format (JS, value)); } #endregion &nbsP } /**////<summary> ///Refresh parent window ///</summary> public static void Refreshparent ( String URL, page page { #region String js = @ "<script language= ' JavaScript ' > window.opener . location.href= ' "+ URL +" '; Window.close ();</script> "; //httpcontext.current.response.write (JS); if (!page. Clientscript.isstartupscriptregistered (page. GetType (), "refreshparent")) { page. Clientscript.registerstartupscript (page. GetType (), "Refreshparent", JS); } #endregion } /**////<summary> ///brushes New open window ///</summary> public static void Refreshopener (Page page) { #region String js = @ "<script language= ' JavaScript ' > opener.location.reload (); </Script>"; // HttpContext.Current.Response.Write (JS); if (!page. Clientscript.isstartupscriptregistered (page. GetType (), "Refreshopener")) { page. ClIentscript.registerstartupscript (page. GetType (), "Refreshopener", JS); } #endregion } /**////<summary> ///Dozen Open a new form of the specified size ///</summary> ///<param name= "url" > Address </param> ///<param name= " Width "> Width </param> ///<param name=" Heigth "> High </param> ///<param name=" Top "> Head position </param> ///<param name= "left" > Left-Hand position </param> public static void Openwebformsize (string URL, int width, int heigth, int top, int left, page page) { #region String js = @ "<script language= ' J Avascript ' >window.open (' + URL + @ ', ', ' height= ' + heigth + ", width=" + width + ", top=" + Top + ", left=" + Left + ", l Ocation=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,titlebar=no,toolbar=no,directories=no '); </ Script> "; //httpcontext.current.response.write (JS); if (!page. Clientscript.isstartupscriptregistered (page. GetType (), "OpenwebformSize ") { page. Clientscript.registerstartupscript (page. GetType (), "Openwebformsize", JS); } #endregion } /**////<summary> // /Turn to URL-made page ///</summary> ///<param name= "url" > Connection address </param> public static void Javascriptlocationhref (string URL, page page) { #region String js = @ "<script language= ' JavaScript ' > window.location.replace (' {0} '); </Script> "; js = string. Format (JS, url); //httpcontext.current.response.write (JS); if (!page. Clientscript.isstartupscriptregistered (page. GetType (), "Javascriptlocationhref")) { page. Clientscript.registerstartupscript (page. GetType (), "Javascriptlocationhref", JS); } #endregion } /**////<summary> / Opens a modal dialog box for a specified size location ///</summary> ///<param name= "Webformurl" > Connection address </param> /// <param name= "width" > Wide </param> ///<param name= "height" > High </param> ///<param name= "top" > Distance position </param> ///<param name= "left" > Distance to position </param> public static void Showmodaldialogwindow (string Webformurl, int width, int height, int top, int left, page page) { #region String features = "Dialogwidt H: "+ width." ToString () + "px" + ";d ialogheight:" + height. ToString () + "px" + ";d ialogleft:" + left. ToString () + "px" + ";d ialogtop:" + top. ToString () + "px" + "Center:yes;help=no;resizable:no;status:no;scroll=yes"; Showmodaldialogwindow ( Webformurl, features, page); #endregion } /**////<summary> ///pop-up modal window /// ;/summary> ///<param name= "Webformurl" ></param> ///<param name= "Features" ></ param> public static void Showmodaldialogwindow (string Webformurl, String features, page page) { str ing js = ShowmodaldialogjavasCript (Webformurl, features); //httpcontext.current.response.write (JS); if (!page. Clientscript.isstartupscriptregistered (page. GetType (), "Showmodaldialogwindow")) { page. Clientscript.registerstartupscript (page. GetType (), "Showmodaldialogwindow", JS); } }