Way -1
Step 1: Create an Empty website named ‘Tutorials_JS’.
1
Step 2: Add a page named ‘Default.aspx’ by right-clicking on the project in the Solution Explorer and click on "Add" -> "New Item".
2
Step 3: Add a button on the page from the Toolbox and Add a function using the javascript in the head tag.
  1. <script language="javascript" type="text/javascript">
  2. function show() {
  3. alert("This is my function");
  4. }
  5. </script>
After that create an ‘OnClientClick’ event on the button with the calling of the ‘show' function.
3
Step 4: Run the Page and click on the button to see the output.
4
Way -2
Step 1: Create a .js file named ‘JScript’.
5
Step 2: Add a function in the .js file.
6
Step 3: Add the .js file on your page and add a button with the ‘OnClientClick’ event which calls the ‘show’ function.
Step 4: Run the Page and click on the button to see the output.
7