logo
g Text Version
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies

dailyclick
Bored? Games!
Nutrition
Postcards
Take a Quiz
Rate My Photo

new
Business Travel
Herbs
Healthy Foods
Classical Music
Spirituality
Judaism
Disabilities


dailyclick
All times in EST

Low Carb: 8:00 PM

Full Schedule
g
g JavaScript / Java Site

BellaOnline's JavaScript / Java Editor

g

An In-Depth Look at Our First JavaScript Program

Guest Author - Julie L Baumler


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
  • "now" is the name of a variable you have defined. A variable is used to hold information of your choice. var is a keyword that tells your program that you are defining a new variable. You also have to tell the program what kind of information you are going to hold in the variable, in this case, it is a date object.

This site needs an editor - click to learn more!

RSS | Related Articles | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


Add An+In%2DDepth+Look+at+Our+First+JavaScript+Program to Twitter Add An+In%2DDepth+Look+at+Our+First+JavaScript+Program to Facebook Add An+In%2DDepth+Look+at+Our+First+JavaScript+Program to MySpace Add An+In%2DDepth+Look+at+Our+First+JavaScript+Program to Del.icio.us Digg An+In%2DDepth+Look+at+Our+First+JavaScript+Program Add An+In%2DDepth+Look+at+Our+First+JavaScript+Program to Yahoo My Web Add An+In%2DDepth+Look+at+Our+First+JavaScript+Program to Google Bookmarks Add An+In%2DDepth+Look+at+Our+First+JavaScript+Program to Stumbleupon Add An+In%2DDepth+Look+at+Our+First+JavaScript+Program to Reddit



For FREE email updates, subscribe to the JavaScript / Java Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor


Content copyright © 2012 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 BellaOnline Administration for details.

g


g features
Hearing Dog Tool - Adding Randomness

Hearing Dog Training Tool – setTimeout()

GCJ - an Independant Java Implementation

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Fav Social Network
Facebook
Twitter
Google+
other / none



BellaOnline on Facebook
g


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


BellaOnline Editor