pspwzrd Posted March 3, 2008 Share Posted March 3, 2008 Does anyone know of any code(maybe javascript, but probably php)that checks the date, and if the number,e.g 29th,is correct,it changes the colour.this is for a calender system i am trying to make,the calender is on www.anticip8-ye.com it isnt finished yet, but can anyone help?thanks Joe p.s only 13,and a bit of a newbie,i know so stuff,but try and make it as simple a pos please! Quote Link to comment Share on other sites More sharing options...
revraz Posted March 3, 2008 Share Posted March 3, 2008 Yep, pretty easy to do. Just have it check if it's today when you output the days and if so, change the color. Quote Link to comment Share on other sites More sharing options...
pspwzrd Posted March 3, 2008 Author Share Posted March 3, 2008 Thanks,but how do i do that,do you know of any code? and thanks for the quick reply:) Quote Link to comment Share on other sites More sharing options...
craygo Posted March 3, 2008 Share Posted March 3, 2008 easiest thing to do is make a couple classes <style> .background1{ background-color: red; } .background2{ background-color: green; } </style> Then like revraz said check the date and assign a style if($date == $today){ $class = "background1"; } else { $class = "background2"; } Then put it in the html for the calendar <sometag class=<? echo $class; ?>> Ray Quote Link to comment Share on other sites More sharing options...
discomatt Posted March 3, 2008 Share Posted March 3, 2008 $cur['day'] = date('j'); $cur['month'] = date('n'); $cur['year'] = date('y'); That will fill it with the server's day/month/year at the moment of execution Quote Link to comment Share on other sites More sharing options...
AV1611 Posted March 3, 2008 Share Posted March 3, 2008 I do it without JS... not cause I'm smart, but cause I don't know JS LOL I simply use a clause in my CSS if() {color: #333;} else {color: #999;} Quote Link to comment Share on other sites More sharing options...
pspwzrd Posted March 3, 2008 Author Share Posted March 3, 2008 im likeing the look of the if/else one, in the brackets would i put : if(document.write(this_date_string)=true) ? Thanks Joe Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.