I can’t seem to get this code working. Im trying to make it so that if the browser is IE6 or lower it will use “horarios2.png” for the img src and no other. And if its any other browser that it will check the weekday(0-6) so that it will fill in the specific image for each day. From Monday(1) to Wensday(3) the image is suposed to be “quarta.png”. The other day’s have their own image. They work seperatly but when I try and put them together I get in trouble and it dosen’t render the image.
Script
$(document).ready (function horario () {
var date = new Date();
var weekday = (date.getDay());
function (msieversion) {
var ua = window.navigator.userAgent
var msie = ua.indexOf ( "MSIE " )
if ( msie > 0 )
return parseInt (ua.substring (msie+5, ua.indexOf (".", msie )))
else
return 0
}
if ((msieversion() == 0 )&&(weekday==0)) {
document.getElementById('horarios').src = "img/domingo.png";}
else if ((msieversion() == 0 )&&(weekday==4)) {
document.getElementById('horarios').src = "img/quinta.png";}
else if ((msieversion() == 0 )&&(weekday==5)) {
document.getElementById('horarios').src = "img/sexta.png";}
else if ((msieversion() == 0 )&&(weekday==6)) {
document.getElementById('horarios').src = "img/sabado.png";}
else if((msieversion() <= 6 )&&(weekday>=0)) {
document.getElementById('horarios').src = "img/horarios2.png";}
else {
document.getElementById('horarios').src = "img/quarta.png";}
});
HTML
<img id="horarios" border="0" alt="" width="343" height="45" />
Here is what I think you meant DEMO HERE (mouseover the image)