<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>innerHTML</TITLE>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.2614.3500" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>For those who are interested I solved the problem
by first creating an object "varlist" and then dynamically adding properties to
the object.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2><html><head><BR><SCRIPT
LANGUAGE="JavaScript1.2"><BR><!--<BR>var varlist = new
Object(Object);<BR>//
--><BR></SCRIPT><BR></head><body><BR><A HREF=#
onclick='Javascript:eval("varlist.prototype.newvar=11");'>create variable
"newvar"</A><BR><BR><A HREF=#
onclick='Javascript:alert("varlist.newvar="+varlist.newvar);'>view
"newvar"</A><BR></body></html></FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>regards</FONT></DIV>
<DIV><FONT face=Arial size=2>Lau</FONT></DIV>
<BLOCKQUOTE
style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A href="mailto:lau@goldenweb.com.au" title=lau@goldenweb.com.au>Lau</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
href="mailto:javascript@LaTech.edu"
title=javascript@LaTech.edu>javascript@LaTech.edu</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Thursday, August 23, 2001 6:06
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [Javascript] dynamically
creating variables using eval()</DIV>
<DIV><BR></DIV>
<DIV><FONT face=Arial size=2>Hi all,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>How can I dynamically create a new javascript
variable that will be available to subsequent scripts.</FONT></DIV>
<DIV><FONT face=Arial size=2>I can use eval("var newvar;newvar=33;") to create
the variable, but the new variable only seems to exist within the scope of the
script block that it was created in. Below is a page that demonstrates what I
mean... the first alert works, the second one says that newvar is
undefined.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial
size=2><html><head></head><body><BR><A HREF=#
onclick='Javascript:eval("var newvar;newvar=33;");alert(newvar);'>create
variable "newvar"</A><BR><BR><A HREF=#
onclick='Javascript:alert("newvar="+newvar);'>view
"newvar"</A><BR></body></html></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Thanks in advance</FONT></DIV>
<DIV><FONT face=Arial size=2>Lau</FONT></DIV></BLOCKQUOTE></BODY></HTML>