SuperSal
Programmer
- Mar 13, 2007
- 33
Hi everyone, Was wondering how i can access array values from an external javascript file to a html page.
The code works if I have it altogether like below:
var IPAddress = new Array("IPAddress", "SaveRequired();", "text", 40, 60, "txtNum") //text field
<script><input name='+IPAddress[0]+' onChange='+IPAddress[1]+' type='+IPAddress[2]+' id='+IPAddress[0]+' size='+IPAddress[3]+' maxlength='+IPAddress[4]+' class='+IPAddress[5]+' /></script>
but when i move the array into an external javascript file and add the code:
<SCRIPT LANGUAGE="JavaScript" src="Scripts/menuitems.js"></script>
it doesnt access the value in the array...can anyone give me a pointer in the right direction
Thanks
Sally
The code works if I have it altogether like below:
var IPAddress = new Array("IPAddress", "SaveRequired();", "text", 40, 60, "txtNum") //text field
<script><input name='+IPAddress[0]+' onChange='+IPAddress[1]+' type='+IPAddress[2]+' id='+IPAddress[0]+' size='+IPAddress[3]+' maxlength='+IPAddress[4]+' class='+IPAddress[5]+' /></script>
but when i move the array into an external javascript file and add the code:
<SCRIPT LANGUAGE="JavaScript" src="Scripts/menuitems.js"></script>
it doesnt access the value in the array...can anyone give me a pointer in the right direction
Thanks
Sally