Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
need help with java script
Old 03-18-2003, 09:00 PM need help with java script
Average Talker

Posts: 17
Location: Kansas City area
Trades: 0
I am trying to have a table project out 5 days. After the 7 day it displayes undetermined instead of the day. After Tuesday, it defaults on Sunday, on Wednesday it will default on Sat and Sun. Here is a copy of a script I used:

// -- made by A1javascripts.com, please keep these credits when using this script
days = new Array(7)
days[1] = "Sunday";
days[2] = "Monday";
days[3] = "Tuesday";
days[4] = "Wednesday";
days[5] = "Thursday";
days[6] = "Friday";
days[7] = "Saturday";
days[8] = "Sunday";
months = new Array(12)
months[1] = "January";
months[2] = "February";
months[3] = "March";
months[4] = "April";
months[5] = "May";
months[6] = "June";
months[7] = "July";
months[8] = "August";
months[9] = "September";
months[10] = "October";
months[11] = "November";
months[12] = "December";
today = new Date(); day = days[today.getDay() + 6]
month = months[today.getMonth() + 1]
date = [today.getDate() + 5]
year=today.getYear();
if (year < 2000)
year = year + 1900;
document.write ("<font size=-2 face='Arial, Helvetica, sans-serif' color=003399> " + day +
", " + month + " " + date + ", " + year + "</font>")
// -- end hiding
</script></font> </td>

I modified it from it's original to project out date further than just today's. I added the days[8] = "Sunday" just so it will work from Tuesday. There has to be something like a if then statement used for basic in Java, so that when 7 is reached it goes back to 1. Any help?
notuboo is offline
Reply With Quote
View Public Profile Visit notuboo's homepage!
 
 
Register now for full access!
Old 03-19-2003, 05:10 PM
david's Avatar
King Spam Talker

Posts: 1,314
Location: Glasgow, UK
Trades: 0
I've been developing a calendar system in PHP recently so I might be able to help a bit.

if (day > 7)
day=day-7;

Haven't tested so it might not work.....
__________________

Please login or register to view this content. Registration is FREE
- Everything a webmaster needs - for free

Please login or register to view this content. Registration is FREE
- Free web hosts reviewed and rated

Please login or register to view this content. Registration is FREE
- Impartial hosting directory - Add your host today for FREE
david is offline
Reply With Quote
View Public Profile
 
Old 03-19-2003, 08:25 PM
Average Talker

Posts: 17
Location: Kansas City area
Trades: 0
no, still undefined.

Tried several variants using varibles. Got NaN value on one day... then got the actual number for the day from the array, but not the actual day.

this answer looked like

2,march 24,
2003

Couldn't get the 2 to convert over to monday.

Thanks for the help... I'm still trying to figure it out.
notuboo is offline
Reply With Quote
View Public Profile Visit notuboo's homepage!
 
Old 03-20-2003, 04:20 PM
david's Avatar
King Spam Talker

Posts: 1,314
Location: Glasgow, UK
Trades: 0
How about:
Code:
currday = today.getDay() + 6;
if (currday > 7)
currday = currday -7;
day = days[currday]
__________________

Please login or register to view this content. Registration is FREE
- Everything a webmaster needs - for free

Please login or register to view this content. Registration is FREE
- Free web hosts reviewed and rated

Please login or register to view this content. Registration is FREE
- Impartial hosting directory - Add your host today for FREE
david is offline
Reply With Quote
View Public Profile
 
Old 03-20-2003, 09:07 PM
Average Talker

Posts: 17
Location: Kansas City area
Trades: 0
It works....

Thanks for the help...
notuboo is offline
Reply With Quote
View Public Profile Visit notuboo's homepage!
 
Reply     « Reply to need help with java script
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.38819 seconds with 12 queries