Results 1 to 9 of 9

Thread: Help Needed

  1. #1

    Thread Starter
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,390

    Help Needed

    i have a function that i call as follows :

    writeComboItem("'<img src=flags/MY.gif>','&nbsp;MY','&nbsp;MY'","#7D7DFF","Sample1147","MY","MY","Sample1");

    the start of the function looks like this

    function writeComboItem(ComboArray,TRbg,TRid,TRval,val2Store,cboName) {
    var arrComboArray = new Array(ComboArray)

    how can i feed in the array to the function? currently it doesn't work and just treets it as a single string


    Thanks Kris

  2. #2

    Thread Starter
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,390
    *bump

  3. #3

    Thread Starter
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,390
    *bump*

    neone???

  4. #4
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090

    Re: Help Needed

    Originally posted by i00

    how can i feed in the array to the function?
    ??

    do you want all those parameters in one array? Do you want the function to do this?
    Have I helped you? Please Rate my posts.

  5. #5

    Thread Starter
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,390
    yes

  6. #6
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    ok, this function will shove all the parameters into one array (called myArr):

    Code:
    function writeComboItem(ComboArray,TRbg,TRid,TRval,val2Store,cboName) {
    myArr = new Array()
    myArr[0] = ComboArray
    myArr[1] = TRbg
    myArr[2] = TRid
    myArr[3] = TRval
    myArr[4] = val2Store
    myArr[5] = cboName
    }
    Have I helped you? Please Rate my posts.

  7. #7

    Thread Starter
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,390
    ino that ... but i don't no how long the array will be - look @ my example


    i have a function that i call as follows :

    writeComboItem(" '<img src=flags/MY.gif>',' MY',' MY' ");

    take note of the double and single quotes - i put the space inbetween to make it easyer to see

    the start of the function looks like this

    function writeComboItem(ComboArray) {
    var arrComboArray = new Array(ComboArray)

    now i want the array arrComboArray to hold the values: (in this example)

    [0] <img src=flags/MY.gif>
    [1] MY
    [2] MY

    but the length may vary because i am feeding into it with asp

    thanks kris
    Last edited by i00; Mar 21st, 2004 at 05:01 PM.

  8. #8
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    if they are always seperated by comma, and none of the variable will hold a comam then you can do this:

    Code:
    function a(myStr) {
    myArr = myStr.split(",")
    }
    now a(" 'a', 'b' , 'r' ") will create an array called myArr which is as follows:
    myArr[0] = " 'a' "
    myArr[1] = " 'b' "
    myArr[2] = " 'r' "

    I would run the function as follows though:
    a("a,b,c,d")
    which would give you
    myArr[0] = "a"
    myArr[1] = "b"
    myArr[2] = "c"
    myArr[3] = "d"
    Have I helped you? Please Rate my posts.

  9. #9

    Thread Starter
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,390
    thanks

Posting Permissions

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



Click Here to Expand Forum to Full Width