Problems Accessing Global Array

G

Gregor

I'm having problems accessing a global array variable from within a
function. I have something like this:

------------------------------------
var detail = new Array( 20 );
detail[ 0 ] = "hello";

function ShowDetail( ) {
top.frames[2].document.clear();
top.frames[2].document.write("<html><body>");

top.frames[2].document.write( detail[ 0 ] );

top.frames[2].document.write("</body></html>");
top.frames[2].document.close();
}
------------------------------------

When I call ShowDetail(), I expect it to write "hello" in the frame, but
instead it writes "undefined." What am I doing wrong?

Thanks,

Greg.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,077
Messages
2,570,567
Members
47,202
Latest member
misc.

Latest Threads

Top