Web Analytics Made Easy -
StatCounter Split function in javascript? - CodingForum

Announcement

Collapse
No announcement yet.

Split function in javascript?

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

  • Split function in javascript?

    I'm having some troubles with it, and not sure exactly how it works, since I just got a little code off of another site. Anyway, this is what I have, but whenever it trys to execute the function, it always fails:

    Code:
    function myfunction(id,linker){
    if (linker){
      arrlinker = split(linker,"|");
    for(i=0; i<UBound(arrlinker); i++){
        if(arrlinker(i) == '50'){
                nullFunction();
             }
       }
    }
    All functions work fine, except when there is a linker. There is also far more too it, but I don't really want to add more details than nessessary. Anyway, if I just have one value in the linker, and instead use if(linker == '50'){nullFunction();} it will work fine, but for some reason this won't. Can anyone explain how the split function correctly works? Thanx!
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #2
    A mistake I see

    arrlinker[i] == '50'){

    and I do not think Javascript uses UBound since that is VBScript....

    You can just use arrlinker.length
    Last edited by A1ien51; Feb 18, 2004, 01:44 PM.
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

    Comment


    • #3
      Originally posted by A1ien51
      A mistake I see

      arrlinker[i] == '50'){

      and I do not think Javascript uses UBound since that is VBScript....

      You can just use arrlinker.length
      Thanx, I finally got that figured out, I just decided to make it more resembling that of what I'm used to and it worked fine.
      Another quick question though, can you call a function within itself?
      As in:
      function myfunction(bunch'ostuff){
      if(bunch'ostuff == 'x'){
      myfunction(lessbunch'ostuff);
      }
      }
      Will that cause it to continue the original function after completing the one inside?
      PHP Code:
      header('HTTP/1.1 420 Enhance Your Calm'); 
      Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

      Comment


      • #4
        Yes it will do just that.

        Basscyst
        Helping to build a bigger box. - Adam Matthews

        Comment

        Working...
        X