Parkpre Posted June 19, 2006 Share Posted June 19, 2006 Hi people! i have this scipt to change an image a day! <script type="text/javascript" language="JavaScript"> var now = new Date (); var day = now.getDay(); //the week begins on SUNDAY if(day == 0) document.write("<img src='entssunday.jpg' width='424' height='82' border='0' align='left'"); if(day == 1) document.write("<img src='entsmonday.jpg' width='424' height='82' border='0' align='left'"); if(day == 2) document.write("<img src='entstuesday.jpg' width='424' height='82' border='0' align='left'"); if(day == 3) document.write("<img src='entswednesday.jpg' width='424' height='82' border='0' align='left'>"); if(day == 4) document.write("<img src='entsthursday.jpg' width='424' height='82' border='0' align='left'"); if(day == 5) document.write("<img src='entsfriday.jpg' width='424' height='82' border='0' align='left'"); if(day == 6) document.write("<img src='entssaturday.jpg' width='424' height='82' border='0' align='left'"); </script> really useful code i think, and working well!what i want is to make the images into links, can some one in the know give me some pointers or amend my script! :ph34r: Cheers! Link to comment Share on other sites More sharing options...
aspnetguy Posted June 19, 2006 Share Posted June 19, 2006 make your document.write staments look somethinglike this document.write("<a href='url'><img src='entssunday.jpg' width='424' height='82' border='0' align='left'"></a>); Link to comment Share on other sites More sharing options...
Parkpre Posted June 20, 2006 Author Share Posted June 20, 2006 cheers ASPNETGUY but im getting a Syntax Error?any ideas? Link to comment Share on other sites More sharing options...
aspnetguy Posted June 20, 2006 Share Posted June 20, 2006 what is the error? I'll have a closer look Link to comment Share on other sites More sharing options...
pulpfiction Posted June 20, 2006 Share Posted June 20, 2006 Small typo in aspnetguy's code, the ending double quotes is in a wrong position. it has to come after the </a>"corrected code:document.write("<a href='http://www.google.com'><img src='Image.jpg' width='424' height='82' border='0' align='left'></a>"); Link to comment Share on other sites More sharing options...
aspnetguy Posted June 20, 2006 Share Posted June 20, 2006 haha oops, thats for hte correction Link to comment Share on other sites More sharing options...
Parkpre Posted June 21, 2006 Author Share Posted June 21, 2006 Cheers!!! Really big help! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now