By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,810 Members | 818 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,810 IT Pros & Developers. It's quick & easy.

how to access a global variable from external javascript file in netscape 4.0

P: 2
I have an external javascript file which contains a global variable - arrNames

Expand|Select|Wrap|Line Numbers
  1. var arrNames=new Array();
  2. arrNames["F"]="FirstName";
  3. arrNames["L"]="LastName";
In my html page I had given the path of this external script file as

<script language="javascript" type="text/javascript" src="Common.js"></script>
<script language="javascript" type="text/javascript">
function x()

<body onload="x();">
This script was working fine in IE.

How can I get arrNames["F"] and arrNames["L"] in function x() in Netscape Navigator 4.08
Sep 20 '06 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 16,027
Use integer indexes (0, 1, 2, etc.) instead of string and remove the language attribute of the script tag. You could also use an array literal instead, e.g. []
May 14 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.