Note that there are some explanatory texts on larger screens.

plurals
  1. POJavaScript Date and browser version function
    primarykey
    data
    text
    <p>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.</p> <p>Script</p> <pre><code>$(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 &gt; 0 ) return parseInt (ua.substring (msie+5, ua.indexOf (".", msie ))) else return 0 } if ((msieversion() == 0 )&amp;&amp;(weekday==0)) { document.getElementById('horarios').src = "img/domingo.png";} else if ((msieversion() == 0 )&amp;&amp;(weekday==4)) { document.getElementById('horarios').src = "img/quinta.png";} else if ((msieversion() == 0 )&amp;&amp;(weekday==5)) { document.getElementById('horarios').src = "img/sexta.png";} else if ((msieversion() == 0 )&amp;&amp;(weekday==6)) { document.getElementById('horarios').src = "img/sabado.png";} else if((msieversion() &lt;= 6 )&amp;&amp;(weekday&gt;=0)) { document.getElementById('horarios').src = "img/horarios2.png";} else { document.getElementById('horarios').src = "img/quarta.png";} }); </code></pre> <p>HTML</p> <pre><code>&lt;img id="horarios" border="0" alt="" width="343" height="45" /&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload