Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript works on Chrome, but no on IE or FF
    text
    copied!<p>I have a Javascript code on my page that counts time since the user logged on.<br> I'm using the script from <a href="http://keith-wood.name/countdown.html" rel="nofollow noreferrer">here</a><br> The thing is the on Chrome, the script works perfectly, but on IE or FF it won't work.<br> Is there anyway I can make it work on all 3 browsers?<br> Thank you! </p> <p><img src="https://i.stack.imgur.com/dE0iS.jpg" alt="enter image description here"></p> <p>My code:<br> Javascript: (the %%DATE%% is replaced by a string like: <code>2011-07-25 14:12:59</code></p> <pre><code>&lt;script type="text/javascript"&gt; function parse_date(string) { var date = new Date(); var parts = String(string).split(/[- :]/); date.setFullYear(parts[0]); date.setMonth(parts[1] - 1); date.setDate(parts[2]); date.setHours(parts[3]); date.setMinutes(parts[4]); date.setSeconds(parts[5]); date.setMilliseconds(0); return date; } //$(function () { // var austDay = new Date(); // austDay = new Date("%%DATE%%"); // austDay.setSeconds(austDay.getSeconds()+3); // $('#time_square').countdown({since: austDay, format: 'MS', compact: true}); //}); function set_time() { var austDay = new Date(); austDay = new Date("%%DATE%%"); austDay.setSeconds(austDay.getSeconds()+3); $('#time_square').countdown({since: austDay, format: 'MS', compact: true}); }; function validate() { var retval = false; for (var i=0; i &lt; document.form.r.length; i++) { if (document.form.r[i].checked) { retval = true; } } return retval; } function set_interval() { setInterval("set_time()",100); } &lt;/script&gt; </code></pre> <p>HTML:</p> <pre><code>&lt;body bgcolor="#000000" topmargin="0" onload="set_interval()"&gt; &lt;table width="166" border="0"&gt; &lt;tr&gt; &lt;td width="45"&gt;&lt;font color="#FFFFFF" size="5px"&gt;Time:&lt;/font&gt;&lt;/td&gt; &lt;td width="111"&gt;&lt;div id="time_square"&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>
 

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