another javascript problem

Results 1 to 2 of 2

Thread: another javascript problem

  1. #1
    mark Guest

    Default another javascript problem

    I have a javascript array Im trying to retrieve and split using the split function. right now, the contents of the array look exactly like this:<BR>dsfgsdfg, fgsdfg, 3434534 <BR>and this is what im trying to do to split it:<BR>saveNote = saveNote.split(saveNote,&#039;,&#039;);<BR>before you start laughing, I tried it with and without the object, but It keeps complaining it needed an object. <BR>I also tried it like so:<BR>saveNote = saveNote.split(&#039;,&#039;);<BR>saveNote = split(saveNote,&#039;,&#039;);<BR>none work... got any ideas? thanks again for the last one bill

  2. #2
    Join Date
    Dec 1969

    Default Show more code?

    But if it&#039;s already an array, how can you split it????<BR><BR>Split is to be used on a *STRING* object. Thus:<BR><BR>var str = "dsfgsdfg, fgsdfg, 3434534"<BR>var anArray = str.split(", ");<BR><BR>Anyway, you can&#039;t split an ARRAY object, just a string. Same as in VBS.<BR><BR>Do you mean you want to split individual elements of the array? Such as<BR><BR>for ( var i = 0; i &#060; saveNote.length; ++i )<BR>{<BR>&nbsp; &nbsp; wordsInOneLine = saveNote[i].split(",");<BR>&nbsp; &nbsp; ...<BR>}<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts