Closed Bug 170907 Opened 22 years ago Closed 22 years ago

function works only once ?!? then forgotten

Categories

(Core :: JavaScript Engine, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 170719

People

(Reporter: mommsen, Assigned: rogerl)

Details

Getting very weird error.... is working with IE.. but mozilla seems to forget
the function once its called !!!! just try with IE to see correct output :-(
Error: outputArray is not defined
Line: 14
Check this out !!!
<HTML>

<HEAD>
<TITLE>Initializing an Array</TITLE>

<SCRIPT LANGUAGE = "JavaScript">
   function initializeArrays()
   {
      var n1 = new Array( 5 );   // allocate 5-element Array
      for ( var i = 0; i < n1.length; ++i )     
         n1[ i ] = i;
      outputArray( "Array n1 contains", n1 );
// and now again and the line wont work !!!! BUG ???
      outputArray( "Array n1 contains", n1 );
   }

   function outputArray( header, theArray )
   {
      document.writeln( "<H2>" + header + "</H2>" );
      document.writeln( "<TABLE BORDER = '1' WIDTH = '100%'>" );
      document.writeln( "<TR><TD WIDTH = '100'><B>Subscript</B>" 
                        + "<TD><B>Value</B></TR>" );                        
   
      for ( var i = 0; i < theArray.length; i++ ) 
         document.writeln( "<TR><TD>" + i + "<TD>" + 
                           theArray[ i ] + "</TR>" );

      document.writeln( "</TABLE>" );
   }
</SCRIPT>

</HEAD><BODY ONLOAD = "initializeArrays()"></BODY>
</HTML>
Read bug 170719 comment #2

*** This bug has been marked as a duplicate of 170719 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
Verified Duplicate.

mommsen@focusit.de: thank you for this report. I see that bug 170719
has been marked as a duplicate of bug 114461, "document.open clobbers js 
context???". If you want to follow this issue further, you should
cc yourself on that bug -
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.