Prev Demo
JavaScript
>
Onload
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body onload="CallFunction()"> <h1>Onload</h1> Enter your name: <input type="text" name="txtName" id="txtName" /> <input type="button" id="btn" name="btn" value="Submit" /> <script> function CallFunction() { document.getElementById("txtName").value = "the page loaded"; } </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output