In this article you learn the basics of JavaScript and create your first JavaScript program.
Creating your first JavaScript Program
In the last lesson you learned how to create simple java script program. To run the program open the html file in any browser and click on the "Run Java Script First Program". The will display the message box. Here is the screen shot of the browser.

Test JavaScript program from here.
Here is the code of JavaScript program:
| <html> <head> <title>First Java Script</title> <script language="JavaScript"> function sayhello(){ alert("Welcome to JavaScript World!"); } </script> </head> <body> <p><b>Click the following link to run your first java script example</b></p> <p><a href="javascript:sayhello()">Run JavaScript First Program</a></p> </body> |
Following is the JavaScript program that will show the message:
<script language="JavaScript">
function sayhello(){
alert("Welcome to JavaScript World!");
}
</script>
The alert() function of the java script displays message.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Writing Simple Java Script Program View All Comments
Post your Comment