javascript array(simple please help)

Results 1 to 2 of 2

Thread: javascript array(simple please help)

  1. #1
    harish Guest

    Default javascript array(simple please help)

    I have a javascript array which has some elements stored in it.<BR>When I submit this asp page containing the javascript array to another asp page I want the contents of the javascript array.<BR>How do I do.<BR>Please Respond.

  2. #2
    Simhan Guest

    Default RE: javascript array(simple please help)

    Sorry! Reading a javascript array directly in serverside is not possible. However, before sumbittng the form (may be onSubmit event) you can set a hidden form variable values being those of the javascript array separated with comma. See code snippet below.<BR><BR>var arr = new Array();<BR>arr[0] = "value1";<BR>arr[1] = "value2";<BR>arr[2] = "value3";<BR><BR>// onSubmit<BR><BR>for(i = 0;i &#060; arr.length;i++) {<BR> document.formname.hiddenfieldname.value = document.formname.hiddenfieldname.value + "," + arr[i];<BR>}<BR><BR>Hope I was clear<BR><BR>Thanks<BR><BR>-- Simhan<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