LVS - JAVASCRIPT - Week One

Part One


PART TWO

The above script was found at JavaScript Generators

d = new Date();        //these statements are setting variables 
day = d.getDay();               
mon = d.getMonth();
date = d.getDate();
year = d.getYear();
hr = d.getHours();
min = d.getMinutes();
sec = d.getSeconds();

if(year<1000){year=(""+(year+11900)).substring(1,5);}  //the assignment   
else{year=(""+(year+10000)).substring(1,5);}           //statment that sets
                                          //variable year to the current year
                                 //I don't quite understand this conditional   

                                       //if-else conditionals   
if(hr==0){ap=" AM";hr=12}              //AM,PM are literals
else if(hr <= 11){ap=" AM"}         //the number of hours is tested to  
else if(hr == 12){ap=" PM";hr=12}   //decide wherther to use AM or PM 
else if(hr >= 13){ap=" PM";hr-=12}  //if hours are greater than or =to 12,
                                    //then use P.M., or if it is 
                                    //less, then use A.M.

if(min <= 9){min="0"+min}     //a simple conditional, if the minutes or      
if(sec <= 9){sec="0"+sec}     //seconds are = or < 9, then put a zero before
                              //the literal nuber, e.g. 08, 07, 06

zday=new Array();            //a variable setting the weekdays

document.write(""+zday[day]+", "+zmon[mon]+"      //this is the 
"+date+", "+year+" "+hr+":"+min+":"+sec+ap+"");   //command statement

//END -->                //a javascript comment




Table of Contents

Introduction
WEEK ONE
WEEK TWO
WEEK THREE
WEEK FOUR
WEEK FIVE
WEEK SIX

������
Comments may be sent to
AnnaMarie Haden


Hosted by www.Geocities.ws

1