1 reply [Last post]
Last seen: 17 years 6 days ago
Joined: 2005-08-15
Posts: 29
Points: 0

Hello Genius here:

i have a registerform page and inside contains javascript for validating various fields such as (postcodes, phone number), and for postcodes i will need to construct a loop and make it compare to the other postcodes that RESIDES in "another" js file.......

so the question is, how can internal javascript in a webpage gain access to arrays inanother js file (external, somewhere out there).???

my internal javascript looks like:

<script type="text/javaScript">
function checkregisterform()

my external javascript looks like:

var postcode = new Array(); //Postcodes that are valid for home delivery
postcode[0] = 2770;
postcode[1] = 2780;
postcode[2] = 2501;
postcode[3] = 2512;

please help! is given me pain....in the head! thank you!

From roger =D

Tony's picture
Last seen: 20 hours 22 min ago
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5344
Points: 2965

urgent!please help! javascript matters

Hi rogermakrm2006,
You just need to link to the other js file and you should be able to access the variables as long as the scope is correct.

<script type="text/javascript" src="your.js" ></script> 
<script type="text/javaScript"> 
function checkregisterform()