Jump to content
W3_Bill

in Firefox, embedded js works in Fedora-27, but not windows-7

Recommended Posts

1.

I have some HTML in which I've embedded some JavaScript.  In Firefox-62, it works on a Fedora-27 workstation as I want, but on a windows-7 box, the browser seems to act as if the script does not exist.  Here is an HTML extract showing the embedded JavaScript:
 

<table>
   <tr>
      <td style="padding: 0;">
         <img id="BianqingPic" src="x" alt=""/>
      </td>
   </tr>
</table>

<p id="BianqingCaption"  class="photocaption">
</p>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<script type="text/javascript">

   "use strict";

   var newPic = "BianQing_";
   var d = new Date();
   //--------------------------------------------------------------------------
   // picture choice is based on deci-hours (1 deci-hour = 6 minutes).
   // all_minutes = (60 * hours) + minutes; range is 0 to 1439.
   // (day-of-month - 1) is then added to throw this "out of sync" with the
   //    ErHu picture choice; range is 0 to 1469.
   // deci-hours = all_minutes / 6; range is 0 to 244.
   //--------------------------------------------------------------------------
   var all_minutes = (d.getMinutes() + (60 * d.getHours())) +
                     (d.getDate() - 1);
   var picnum = (Math.floor ( all_minutes / 6  ) % 7) + 1;
   document.getElementById ( "BianqingCaption" ).innerHTML =
        "Biān Qìng" + "&nbsp&nbsp(picture #" + picnum + " of 7; " +
        "based on deci-hours)";
   newPic = newPic + picnum + ".jpg";
   document.getElementById("BianqingPic").src = newPic;

</script>

I tried adding "console.log" statements just after the "use strict;" line, and between the last two lines of the script body.  Absolutely nothing shows up in the web console or the browser console.  Why is the script (apparently) being ignored?  The windows-7 and the Fedora-27 systems were updated last week, as was Firefox.

By the way,  the w3schools page "https://www.w3schools.com/js/js_debugging.asp" is out of date.  Firefox no longer uses Firebug, and the web site pointed to by the link provided for getting Firebug no longer exists.

Thank-you in advance for your help.

Bill.

Share this post


Link to post
Share on other sites

If there are no messages at all in the console, then maybe the browser is using a tighter security policy where it doesn't run the script at all.

Share this post


Link to post
Share on other sites

Thank-you for your response.

Well, I can't explain it, but now it works as desired.  I didn't do anything but reboot and try it on different days!

Don't you just love it when problems mysteriously fix themselves or disappear?!

Bill.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×