This is a discussion on "Difficult Javascript Problem!" within the JavaScript Forum section. This forum, and the thread "Difficult Javascript Problem! are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Difficult Javascript Problem!
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
||||
|
||||
|
Hi guys,
Here's one to rack your brains over. I want to use a javascript in order to change the color of some text depending on the current date. For example, i want to define 2 dates, and if the current date is within those 2 dates it displays one colored text and if it is outside that date it displays a different colored text. To get an example of what i mean go to www.ecampsite.co.uk/somerset.php If a campsite is open, the text will be green, and if it is closed it is orange. Is there any way to automate this with javascript?? Your input regarding this will be invaluable! Thank you Craig |
|
|
|
#2
|
||||
|
||||
|
Re: Difficult Javascript Problem!
cant you do that with php?
|
|
#3
|
||||
|
||||
|
i dont have have a database, would you be able to do it thru just php on a page, that would be a mega help!!!
|
|
#4
|
|||
|
|||
|
Re: Difficult Javascript Problem!
yeah you can use if statments, for example:
php:
|
|
#5
|
||||
|
||||
|
Re: Difficult Javascript Problem!
how would i write an if statement, if the criteria was between 2 dates? and if the it is between the dates, it would change the text color to a different color.
Its not really whether we're full, but i think it would be somewhere along those lines!! Thank you so far!!! |
|
#6
|
|||
|
|||
|
Re: Difficult Javascript Problem!
you see this would be easier if you had a database...
as each date will have to be a variable so you have to edit each page...so basicly just adding the colour yourself would be better... if you had a database you could just have an admin backend and make the script do all the work... |
|
#7
|
||||
|
||||
|
Re: Difficult Javascript Problem!
SOLVED - a good friend of mine (a bloody genius) has written some php code for me which solves my problem!!!
Craig
|
|
#8
|
|||
|
|||
|
Re: Difficult Javascript Problem!
there ya go then
|
![]() |
| Tags |
| difficult, javascript, problem |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Would this be difficult to do | AdRock | Webforumz Suggestions and Feedback | 6 | Nov 6th, 2007 12:42 |
| Javascript problem | zc1 | JavaScript Forum | 2 | Jan 15th, 2007 17:01 |
| too difficult for a noob | Cam | PHP Forum | 5 | Feb 4th, 2004 22:15 |
| CSS Difficult? | Galaxyblue | Web Page Design | 11 | Jan 27th, 2004 19:18 |