FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Embed Javascript for Alert and self.close in C# .NET

 


shenyl
I have developed these 2 JS that I find useful in my Web Development.

You can cut and paste as a class within your source code, and use the Static Class methods.

You need to use Response.Write(one of the 2 static methods).

Here are the codes:

public class clUtilJS
{
// To form an JS Alert Message
static private string jsText1 =
"<script language=javascript>alert(\"";
static private string jsText2 = "\")</script>";
static private string jsSelfClose =
"<script language=javascript>self.close();</script>";

public clUtilJS()
{
//
// TODO: Add constructor logic here
//
}

static public string SetJSAlert(string INMsg)
{
// Format the JS statement to be Send to the Browser
return (jsText1 + INMsg + jsText2);
}

static public string JSSelfClose()
{
// Return the Javascript for self.close
return jsSelfClose;
}

}

Feedback for improvement are welcomed.
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.