...

View Full Version : Can somebody explain why the ALERT doesn't work here



html_amnesiac
04-08-2009, 06:46 PM
I am having to extract a subset array from my main array to enable me to get the index position.

This code works in setting up the subset array:



<script type="text/javascript">
var rand = new Array();
var john = new Array();

function test_example(){
for (j = 0; j <= drirejs.length; j++) {
drire_element=drirejs[j];
arrayofparts=drire_element.split("");
title=arrayofparts[1];
john [j]= title;
}
alert("got here");
}
</script>


I have run this and put the output on the screen and it is fine.

I have taken out the document.write and replaced it with the alert, but after the "}" as above.

The alert does not happen.

I want to then add this to find the element inthe array :



drire_index=john.indexOf("CENTRE - Loir-et-Cher(41)");
alert(drire_index);


The string I am looking for is definitely in the array, I copied and pasted it from the original document.write on the screen.

The problem is that this won't alert either.

Is there a problem in my function causing the alerts not to happen



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum