Closed Bug 269408 Opened 20 years ago Closed 20 years ago

second access to global JS variable fails

Categories

(Core :: DOM: Core & HTML, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 114461

People

(Reporter: chkr, Unassigned)

Details

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040926 Galeon/1.3.18 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041109 Firefox/1.0 I get an Error in the JavaScript console with this simple JavaScript code. The second 'document.write(...);' is the offending line. <html> <head> <script type="text/javascript"> <!-- var arr = new Array('a','b'); function PageInit() { document.write("arr is " + arr + "<br>"); document.write("arr is " + arr + "<br>"); } //--> </script> </head> <body onLoad="PageInit()">Body</body> </html> It is a very strange effect, because only the second access to the arr variable fails. The error does not occur with local variables. Reproducible: Always Steps to Reproduce: View the supplied html file in the browser and have a look at the JavaScript console. Actual Results: Error: arr is not defined Source File: file:///tmp/sample.html Line: 8 Expected Results: the content of the variable arr should be output twice The same piece of javascript is interpreted well in the konqueror's javascript engine.
Assignee: general → general
Component: JavaScript Engine → DOM: Level 0
QA Contact: pschwartau → ian
*** This bug has been marked as a duplicate of 114461 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.