By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,930 Members | 1,492 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,930 IT Pros & Developers. It's quick & easy.

Calling script code

P: n/a
Hi!

How can I call the Javacript or Vbscript code from
Web form provided that the Script code resides on
the same web form.aspx

Regards

Imran
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi IMRAN SAROIA,

i am attaching a sample code for your understanding.

1> Create a new aspx Page.
2> Include Using System.IO on the page.
3> Add a button to the newly created aspx page
4> Paste this code in the Page_Load
private void Page_Load(object sender, System.EventArgs e)
{
StringBuilder myScript = new StringBuilder();

myScript.Append("<script language='Javascript'>");
myScript.Append(" function HelloWorld(){");
myScript.Append(" alert('Hello There From Hello World');");
myScript.Append("}");
myScript.Append("</script>");

this.RegisterStartupScript("MyScript", myScript.ToString());

Button1.Attributes.Add("onclick","javascript:Hello World();");
}
5> run the page.

HTH
Regards
Ashish M Bhonkiya

"IMRAN SAROIA" <im*************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi!

How can I call the Javacript or Vbscript code from
Web form provided that the Script code resides on
the same web form.aspx

Regards

Imran

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.