View Full Version : Javascript; Change picture based on date

09-14-2011, 12:18 PM
I'm new to coding and recently undertook the position as my school district's webmaster. We use a six day schedule where the days are labeled A-F. I want to be able to display the Today is...A graphic based on the date. I tried some scripts from other forums, but it does not appear to be working. Any suggestions? TY
<script language="javascript">
var picture='';
mytime=new Date();
if (mymonth==9 && mydate==13){picture="<img src=/images/d.gif>";
if (mymonth==9 && mydate==14){picture="<img src=/images/e.gif width=150 height=150 alt=E>";
if (mymonth==9 && mydate==15){picture="<img src=/images/f.gif width=150 height=150 alt=F>";
if (mymonth==9 && mydate==16){picture="<img src=/images/A.gif width=150 height=150 alt=A>";
if (mymonth==9 && mydate==19){picture="<img src=/images/B.gif width=150 height=150 alt=B>";
if (mymonth==9 && mydate==20){picture="<img src=/images/c.gif width=150 height=150 alt=C>";

09-14-2011, 01:22 PM
It would work ... but your code never adds or replaces the new picture anywhere ... that's why it will never show

Add this code


to the end of the posted code