How to Run Javascript First Program
Example
“Welcome to PHPGurukul!” program:
Open Notepad, write JavaScript codes as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<html> <head> <title> The first JavaScript Program </title> <head> <body> <script language="javascript"> document.write ("<h2>Welcome to PHPGurukul! </h2>") </script> </body> </html> |
Please save the file with name “JavaScriptFirstProgram.html”.
Double click “First JavaScript.html” file, the ” JavaScriptFirstProgram.html” will be run in a browser, and see the output.
Welcome to PHPGurukul!
Explanation
document.write ("<h2>Welcome to PHPGurukul! </h2>")
the output will be Welcome to PHPGurukul!