C # Some message processing methods.

Source: Internet
Author: User

C # Some message processing methods.

/// <Summary>
/// Client Script: Alert (MSG) I;
/// </Summary>
/// <Param name = "MSG"> Message to be displayed </Param>
/// <Returns> Client script of the alert function </Returns>
Public Static String Client_alert ( String MSG)
{
Return " <Script language = " Javascript " > Alert ( "" + MSG + "" ); </SCRIPT> " ;
}

/// <Summary>
/// Client Script: Alert (MSG) II; /// </Summary>
/// <Param name = "MSG"> Message to be displayed </Param>
/// <Param name = "returnurl"> Return address </Param>
/// <Returns> Returns the specified URL. </Returns>
Public Static String Client_alert ( String MSG, String Returnurl)
{
Return " <Script language = " Javascript " > Alert ( "" + MSG + "" ); Location. href =' " + Returnurl + " '; </SCRIPT> " ;
}

/// <Summary>
/// Client Script: confrim (MSG) I;
/// </Summary>
/// <Param name = "MSG"> Message to be confirmed </Param>
/// <Param name = "url"> Address to be switched after confirmation </Param>
/// <Returns> Client script of the confirm Function </Returns>
Public Static String Client_confirm ( String MSG, String URL)
{
String Scripts = " <Script language = " Javascript " > " +
" If (confirm (' " + MSG + " ')) " +
" {Location. href =' " + URL + " ';} " +
" </SCRIPT> " ;
Return Scripts;
}

/// <Summary>
/// Client Script: confrim (MSG) II;
/// </Summary>
/// <Param name = "MSG"> Message to be confirmed </Param>
/// <Param name = "cfmurl"> Address to be switched after confirmation </Param>
/// <Param name = "retrunurl"> Address to be switched after cancellation </Param>
/// <Returns> Client script of the confirm Function </Returns>
Public Static String Client_confirm ( String MSG, String Cfmurl, String Retrunurl)
{
String Scripts = " <Script language = " Javascript " > " +
" If (confirm (' " + MSG + " ')) " +
" {Location. href =' " + Cfmurl + " ';} " +
" Else {location. href =' " + Retrunurl + " ';}</SCRIPT> " ;
Return Scripts;
}
/// <Summary>
/// No message is displayed when the window is closed!
/// </Summary>
Public Static String Client_closewindow ()
{
Return " <SCRIPT> window. Opener = NULL; window. Close (); </SCRIPT> " ;
}
/// <Summary>
/// A prompt is displayed before closing the window.
/// </Summary>
/// <Param name = "MSG"> Message for disabling </Param>
Public Static String Client_closewindow ( String MSG)
{
Return " <SCRIPT> If (confirm (' " + MSG + " ') {Window. Opener = NULL; window. Close () ;}else {return false ;}</SCRIPT> " ;
}

/// <Summary>
/// Client Script: Redirection URL
/// </Summary>
/// <Param name = "url"> Redirected URL </Param>
/// <Param name = "copyhistory"> Record history? </Param>
/// <Returns> Client script block for Redirection URL </Returns>
Public Static String Client_redirect ( String URL, Bool Copyhistory)
{
Return (Copyhistory) ? " <Script language = " Javascript " > Top. Location. href =' " + URL + " '; </SCRIPT> " : " <Script language = " Javascript " > Top. Location. Replace (' " + URL + " '); </SCRIPT> " ;
}
# Endregion

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.