Adding javascript to your pages: You can embed javascrip into your aspx pages either internally or externally. Let’s see how you can add javascrip within your webpages.
Add the following code inside < head > tag of your .aspx page.
< script type=”text/jaavscript” > fuction fun() { alert(“asp.net”); } < / script >
Now in order to let this event action work add the following code to button in your .aspx page.
OnClientClick=fun();
Linking to external Javascript file: If you want to link to external Javascript file, make sure you do the following steps:
1. Right Click on your project folder > “Add New Item” > “Javascript File”. 2. Write the code you want in the Javascript file.
Add the following code in your Default.aspx or respective .aspx file to link Javascript file.
< Script src=”JScript.js” type=”text/javascript” > < /script >
If you’ve done the above steps then you’ll find that javascripts are added to your asp page. If you've any questions or suggestions/feedback let me know it in the comments.