Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript Error & I Don't know why 1

Status
Not open for further replies.

cruella369

Technical User
Mar 16, 2001
8
US
I have written code for my webpage ( that rotates the Djs pages based on the hour & the day. It works M-F, but I cannot get it to work Sat or Sun. Can anyone help?
 
Duh, here is the script

<script language=&quot;JavaScript&quot;>



<!-- Begin

var today = new Date();

var hrs = today.getHours();

var day = today.getDay();





if ((day >1) && (day<= 5))



if ((hrs >= 0) && (hrs < 1 )){

document.writeln(&quot;<A HREF=mailto:charlieb@klsyradio.com><IMG SRC=\&quot;images/charlie.gif\&quot;></a>&quot;);

}

else if ((hrs >= 1) && (hrs < 5)){

document.writeln(&quot;<A HREF=mailto:franks@klsyradio.com><IMG SRC=\&quot;images/franks.gif\&quot;></a>&quot;);

}

else if ((hrs >= 5) && (hrs < 9)){

document.writeln(&quot;<a href=mha.html><IMG SRC=\&quot;images/MHAsmall.gif\&quot;></a>&quot;);

}

else if ((hrs >= 9) && (hrs < 13)){

document.writeln(&quot;<A HREF=mailto:danad@klsyradio.com><IMG SRC=\&quot;images/dana.gif\&quot;>&quot;);

}

else if ((hrs >= 13) && (hrs < 15)){

document.writeln(&quot;<A HREF=mailto:barrym@klsyradio.com><IMG SRC=\&quot;images/barry.gif\&quot;>&quot;);

}

else if ((hrs >= 15) && (hrs < 20)){

document.writeln(&quot;<A HREF=mailto:peterm@klsyradio.com><IMG SRC=\&quot;images/peter.gif\&quot;></a>&quot;);

}

else if (hrs >= 20) {

document.writeln(&quot;<A HREF=mailto:charlieb@klsyradio.com><IMG SRC=\&quot;images/charlie.gif\&quot;></a>&quot;);

}



else if (day >= 6)



if ((hrs >= 1) && (hrs < 5 )){

document.writeln(&quot;<IMG SRC=\&quot;images/rong.gif\&quot;>&quot;);

}

else if ((hrs >= 5) && (hrs < 9)){

document.writeln(&quot;<IMG SRC=\&quot;images/kurtdotcom.gif\&quot;>&quot;);

}

else if ((hrs >= 9) && (hrs < 13)){

document.writeln(&quot;<IMG SRC=\&quot;images/dana.gif\&quot;>&quot;);

}

else if ((hrs >= 13) && (hrs < 16)){

document.writeln(&quot;<IMG SRC=\&quot;images/kenc.gif\&quot;>&quot;);

}

else if ((hrs >= 16) && (hrs < 20)){

document.writeln(&quot;<IMG SRC=\&quot;images/annad.gif\&quot;>&quot;);

}

else if (hrs >= 20) {

document.writeln(&quot;<IMG SRC=\&quot;images/janetw.gif\&quot;>&quot;);

}



else if (day <= 0)


if ((hrs >= 1) && (hrs < 5 )){

document.writeln(&quot;<IMG SRC=\&quot;images/kurtdotcom.gif\&quot;>&quot;);

}

else if ((hrs >= 5) && (hrs < 9)){

document.writeln(&quot;<IMG SRC=\&quot;imagesrong.gif\&quot;>&quot;);

}

else if ((hrs >= 9) && (hrs < 13)){

document.writeln(&quot;<IMG SRC=\&quot;images/kenc.gif\&quot;>&quot;);

}

else if ((hrs >= 13) && (hrs < 16)){

document.writeln(&quot;<IMG SRC=\&quot;imagesfrank.gif\&quot;>&quot;);

}

else if ((hrs >= 16) && (hrs < 20)){

document.writeln(&quot;<IMG SRC=\&quot;images/vonf.gif\&quot;>&quot;);

}

else if (hrs >= 20) {

document.writeln(&quot;<IMG SRC=\&quot;images/charlie.gif\&quot;>&quot;);

}



// End -->

</script>
 
are you getting an error? if so, what is it? luciddream@subdimension.com
 
I'm not getting an error, it's just not posting a picture
 
this should fix it:

var today = new Date(&quot;03/18/2001&quot;);
var hrs = today.getHours();
var day = today.getDay();
if ((day >= 1) && (day <= 5))
{
if ((hrs >= 0) && (hrs < 1 ))
{
document.writeln(&quot;<A HREF=mailto:charlieb@klsyradio.com><IMG SRC=\&quot;images/charlie.gif\&quot;></a>&quot;);
}
else if ((hrs >= 1) && (hrs < 5))
{
document.writeln(&quot;<A HREF=mailto:franks@klsyradio.com><IMG SRC=\&quot;images/franks.gif\&quot;></a>&quot;);
}
else if ((hrs >= 5) && (hrs < 9))
{
document.writeln(&quot;<a href=mha.html><IMG SRC=\&quot;images/MHAsmall.gif\&quot;></a>&quot;);
}
else if ((hrs >= 9) && (hrs < 13))
{
document.writeln(&quot;<A HREF=mailto:danad@klsyradio.com><IMG SRC=\&quot;images/dana.gif\&quot;>&quot;);
}
else if ((hrs >= 13) && (hrs < 15))
{
document.writeln(&quot;<A HREF=mailto:barrym@klsyradio.com><IMG SRC=\&quot;images/barry.gif\&quot;>&quot;);
}
else if ((hrs >= 15) && (hrs < 20))
{
document.writeln(&quot;<A HREF=mailto:peterm@klsyradio.com><IMG SRC=\&quot;images/peter.gif\&quot;></a>&quot;);
}
else if (hrs >= 20)
{
document.writeln(&quot;<A HREF=mailto:charlieb@klsyradio.com><IMG SRC=\&quot;images/charlie.gif\&quot;></a>&quot;);
}
}
else if (day == 6)
{
if ((hrs >= 0) && (hrs < 5 ))
{
document.writeln(&quot;<IMG SRC=\&quot;images/rong.gif\&quot;>&quot;);
}
else if ((hrs >= 5) && (hrs < 9))
{
document.writeln(&quot;<IMG SRC=\&quot;images/kurtdotcom.gif\&quot;>&quot;);
}
else if ((hrs >= 9) && (hrs < 13))
{
document.writeln(&quot;<IMG SRC=\&quot;images/dana.gif\&quot;>&quot;);
}
else if ((hrs >= 13) && (hrs < 16))
{
document.writeln(&quot;<IMG SRC=\&quot;images/kenc.gif\&quot;>&quot;);
}
else if ((hrs >= 16) && (hrs < 20))
{
document.writeln(&quot;<IMG SRC=\&quot;images/annad.gif\&quot;>&quot;);
}
else if (hrs >= 20)
{
document.writeln(&quot;<IMG SRC=\&quot;images/janetw.gif\&quot;>&quot;);
}
}
else if (day == 0)
{
if ((hrs >= 0) && (hrs < 5 ))
{
document.writeln(&quot;<IMG SRC=\&quot;images/kurtdotcom.gif\&quot;>&quot;);
}
else if ((hrs >= 5) && (hrs < 9))
{
document.writeln(&quot;<IMG SRC=\&quot;imagesrong.gif\&quot;>&quot;);
}
else if ((hrs >= 9) && (hrs < 13))
{
document.writeln(&quot;<IMG SRC=\&quot;images/kenc.gif\&quot;>&quot;);
}
else if ((hrs >= 13) && (hrs < 16))
{
document.writeln(&quot;<IMG SRC=\&quot;imagesfrank.gif\&quot;>&quot;);
}
else if ((hrs >= 16) && (hrs < 20))
{
document.writeln(&quot;<IMG SRC=\&quot;images/vonf.gif\&quot;>&quot;);
}
else if (hrs >= 20)
{
document.writeln(&quot;<IMG SRC=\&quot;images/charlie.gif\&quot;>&quot;);
}
} luciddream@subdimension.com
 
just make sure that the document.writeln's are on one line, cause they got kinda split up when i pasted. luciddream@subdimension.com
 
oh yeah... and take out the string in the new Date(), that was so i could test it. luciddream@subdimension.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top