Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Why doesn't this javascript code work in firefox?

Why doesn't this javascript code work in firefox?

Scheduled Pinned Locked Moved Web Development
javascripttestingbeta-testingquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bfis108137
    wrote on last edited by
    #1

    It works in ie8, opera, and chrome. I am new to javascript so maybe this is well known. The page is at the link below. http://baruchfishman.info/testing/2.htm

    N D 2 Replies Last reply
    0
    • B bfis108137

      It works in ie8, opera, and chrome. I am new to javascript so maybe this is well known. The page is at the link below. http://baruchfishman.info/testing/2.htm

      N Offline
      N Offline
      NeverHeardOfMe
      wrote on last edited by
      #2

      Have to admit I'm somehwat surprised it works in them - but Firefox has a pretty good Error console built in you know - look on the Tools menu. That straightaway tells you that the problem is that "Display" is undefined (Hence my "somewhat surprise".) You need to define this before any of the functions are called but after the page loads - so either add another script block at the foot of the page with just var Display = document.getElementById("Display"); in it, or add this Iwithout the var) as a one-line function in your block at the top and call it from the body onload method. - if you do it this latter way, you'll need to also define var Display; separately as a global variable outside the function. -- Modified Sunday, August 29, 2010 3:42 PM

      1 Reply Last reply
      0
      • B bfis108137

        It works in ie8, opera, and chrome. I am new to javascript so maybe this is well known. The page is at the link below. http://baruchfishman.info/testing/2.htm

        D Offline
        D Offline
        DaveAuld
        wrote on last edited by
        #3

        bfis108137 wrote:

        It works in ie8, opera, and chrome

        It doesn't work properly in chrome. I just tried. The first calculation works, any subsequent one doesn't. I think your logic is flawed when you calculate, think about when you use a normal calculator. The result is put back into the first operand. if another digit is then pressed instead of an operation the operand is cleared and you start to loadup the new 1st operand.

        Dave Don't forget to rate messages!
        Find Me On: Web|Facebook|Twitter|LinkedIn

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups