Web Analytics Made Easy -
StatCounter Can somebody explain why the ALERT doesn't work here - CodingForum

Announcement

Collapse
No announcement yet.

Can somebody explain why the ALERT doesn't work here

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can somebody explain why the ALERT doesn't work here

    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:

    Code:
    <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 :

    Code:
    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
Working...
X