Two Ways to Call a JavaScript Function at the Time of Page Loading

Add a page named ‘Test.aspx’ by right-clicking on the project in Solution Explorer and click on "Add" -> "New Item"

First Way

Step 1: Add a function named ‘load ()’ in javascript which will show a alert message and after that create a onload event in body tag with the calling of ‘load()’.


Step 2: Run the Application and see the output.


Second Way

Step 1: Add a javascript alert message with in the body Tag of Page.


Step 2: Run the Application and see the output.


Ebook Download
View all
Learn
View all