Jump to content

What am I doing wrong here..?


woolyg

Recommended Posts

Here's my javascript:

 

for(i=0;i<=20;i++)
{
   // msg_data_array is a string with 20 items in it, all delimited by 2 hashes - ##
    var msgtext = msg_data_array[i].split('##');
}

 

 

The script returns msgtext just fine, but I'm getting an error in firebug:

 

  msg_data_array is undefined

 

.. Can anybody shed any light on this?

 

All info appreciated.

 

Thanks

WoolyG

 

 

 

Link to comment
Share on other sites

Sorry, I should have specified.

 

msg_data_array is an array built out of a long string (messages_list), split and delimited by two colons.

 

Just above the for() loop, is this code:

var msg_data_array = messages_list.split('::');

 

Any ideas?

Link to comment
Share on other sites

Can you show the code in context? There doesn't appear to be anything wrong with the statements you've shown, so it's likely something else around them. Also you quote the error, is that the exact error? If it was "msg_data_array is undefined", then it's because that index doesn't exist.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.