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

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++) {
john [j]= title;
alert("got here");

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)");

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