C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...








Our first JavaScript program



First.Html





Let us write a simple HTML page and learn how to embed Javascript in the HTML pages.

This is a simple program , just displays text message that is given by the user.

Type the following code in notepad or copy and paste it in the note pad.



<html>

<body>

<script text =”javascript">

document.write("Welcome to DotnetSpider Tutorials!");

</script>

</body>

</html>



Create a folder called JavaScript in D: Drive

Save the code that is written in notepad as First.Html

A file with extension .html is created.

The purpose of <script text =”javascript"> to tell the browser that it is JavaScript.
On the other hand document.write is used to write the output for the page.

What ever the text that is given in the “” that is executed.

Ending the statements with ‘;’ is not mandatory. It’s developer choice to omit or use.

But how ever semicolons are needed if we want to write more than one statement on a single line. But it is always a good practice to make our code as readable and beautify it proper indentation . So it's suggested to seperate the multiple statements ,instead of clubbing all the statements in a single line.

To run it:


Like how you run a simple HTML program just double click on the First.html Or Right click on the mouse and click on browse.

Now your first JavaScript Program is displayed on browser.





Next Chapter: Formatted text


Previous Chapter: Important points to make a note about JavaScript


Tutorial Index




dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use