g
Printer Friendly Version

editor   Editor Wanted
BellaOnline's JavaScript / Java Editor
 

An In-Depth Look at Our First JavaScript Program


In my previous article, A First JavaScript Program, we introduced the hello_world.html program (click here to try it). In this article we look at it again. This time, the code is color coded by function and if you click on a bit of code, it is linked to short explanations and references to in-depth explainations. The color code is explained after the program.





<html>
<head><title>

Hello World in JavaScript

</title></head>
<body>


<script type="text/javascript">



<!--


// get the current date and time


var now = new Date()




// Check the time



if
( now.getHours() < 12 )


{



// It's before noon

// print "Good Morning World!" in the window


document.write("Good Morning World!")


}

else

{



// It's after noon

// just print "Hello World!" in the window


document.write("Hello World!")


}



//-->



</script>



<noscript>


Hi Non-JavaScript User!


</noscript>



</body></html>











ColorRepresents
greenhtml tags
blacktext
aquacomments
limecontrol flow
oliveobjects and methods
maroontest
silvervariables





HTML Tags

Text

Comment

My article on Using the Script and Noscript Tags (COMING SOON)


Flow Control

Objects and Methods

Variables

This site needs an editor - click to learn more!

JavaScript / Java Site @ BellaOnline
View This Article in Regular Layout

Content copyright © 2009 by Julie L Baumler. All rights reserved.
This content was written by Julie L Baumler. If you wish to use this content in any manner, you need written permission. Contact Editor Wanted for details.



| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2009 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor