Why doesn't this javascript code work in firefox?
-
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
-
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
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
-
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
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