JavaScript Question

Joel Hammer Joel
Mon May 17 11:35:25 PDT 2004


Just puzzled by this. I am writing some javascript code.
So far, opera (6.01) in linux has performed identically to
internet explorer in windows. Very nice.
However, I think I have found a bug in the javascript
implementation in opera. The following code:
if (typeof n == "object");
                 form[name].checked = false;   

works fine in IE but doesn't in opera. There is no error generated by opera
with it either. 
(As soon as this if statement runs, a function is called
which checks the checked status of this form element, and then changes the
checked status of another form element depending on the status of this element.)
(n is the variable returned from a prompt box,eg. n = prompt(etc...) )
If I put an alert statement in there, like so:

if (typeof n == "object"){
                 alert ("You pressed cancel")
                 form[name].checked = false}

Then it works fine in both opera and IE. Other delays solve the problem,
too. A statement like:
A construct like:
if (typeof n == "object"){
                 for (var i = 0;i < 500;i++){var j = 1} 
                 form[name].checked = false}

works, but if the 500 is change to 100 it doesn't work.
Other types of statements, eg.  var zz = 1  don't help.
Has anybody seen this type of behavior in javascript or other computing
languages?
Any insight appreciated,
Joel
   



More information about the Linux-users mailing list