Write Hello World! using Javascript - document.write()
Posted by on Saturday, November 27, 2010 Under: Javascript
In : Javascript
Tags: "javascript" "statement"
blog comments powered by Disqus
Now we are going to write "Hellow World!!!" on the page using Javascript..
Type this code on your text editor and save it as a HTML document like "hellowWorld.html" or something else..
Then open it with your Internet Browser
You will see the result like
Hellow World!!!
************************************
We can embed Javascript inside the <body>....</body> tags like above example. And inside the <head>...</head> tags. Let's see it later...
What is the document.write()
document.write() is a command to your browser. We call it as a Statement
in this document.write() statement tells to the browser to write something on the page
in this case it tells to write Hellow World!!! on the page..
We can write some strings with double or single quotes like this and we can add two strings using + operator
* try this one as an activity : document.write(" Hi "+" Hellow "+" World ");
And we can insert some HTML tags inside the brackets
* try these activities
document.write("<b>Hellow</b> World!!! ");
document.write("<p><i><u>Hellow</u> World!!!</i> </p>");
document.write("<h1>Hellow World!!!</h1>");
document.write("<p>Hellow <br /> World!!! </p>");
In : Javascript
Make a free website with Yola