Kahuki Webmaster Forum  

Go Back   Kahuki Webmaster Forum > Website Development & Management > Programming > JavaScript

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-25-2007, 12:49 PM
Member
 
Join Date: Dec 2005
Posts: 58
weevilboy is on a distinguished road
Please help me with this code

heres what the code should look like in somewhat plain english:
If this month = January to March
{Hello}
Else
{Goodbye}

Can anyone come up with the code? I just started using javascript so i couldnt really follow any tutorials..its all cut and paste for me. Thanks in advance!

Reply With Quote
  #2 (permalink)  
Old 04-25-2007, 01:04 PM
Rookie
 
Join Date: Jan 2007
Posts: 1
rumit123 is on a distinguished road
today=new Date();

if (today.getMonth() > 2) {
document.write('Hello
');
} else {
document.write('Goodbye
');
}

Indent as necessary.

Reply With Quote
  #3 (permalink)  
Old 04-25-2007, 01:21 PM
Member
 
Join Date: Jun 2007
Posts: 59
Loste is on a distinguished road
<SCRIPT language = JavaScript>
var my_month=new Date()
var month_name=new Array(12);
month_name[0]="January"
month_name[1]="February"
month_name[2]="March"
month_name[3]="April"
month_name[4]="May"
month_name[5]="June"
month_name[6]="July"
month_name[7]="August"
month_name[8]="September"
month_name[9]="October"
month_name[10]="November"
month_name[11]="December"
c = month_name[my_month.getMonth()];

if (c == "January" || c == "February" || c == "March") {

alert("Hello : " + c)

}
else
{
alert("Goodbye : " + c)
}

</SCRIPT>

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
css code??? Lucia99 Webdesign & HMTL 2 01-02-2008 05:11 AM
Adsense Code? warhammer Monetization 7 10-29-2007 09:59 PM
Css Help: How To Cancel Css On a Particular Code? DonGigi Webdesign & HMTL 1 09-26-2006 04:45 PM
I have css code on a website telling links to change color and it works. I put this same css code? dondi Webdesign & HMTL 4 06-30-2006 06:44 PM
Can PHP read in source code from another webpage external of the server to which the PHP code is run on? abrahamthomas PHP 5 06-30-2006 12:53 PM


All times are GMT. The time now is 12:05 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0