DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: simple question

  1. #1
    Join Date
    Mar 2004

    Question simple question

    hi, my mates doin an assignment, i was trying to help him, but i don't know java script very well.

    now, we have a bunch of input types on the screen, from radio buttons to drop down boxes to text boxes. What we wanna know is, all that info has to be taken from the boxes using javascript and stored in an array. This info is then to be accessed and processed.

    COuld sum1 please give me some pointers, for example, once i've assigned all the info from the input types to variables... how do i get it all into one array, so every time i hit "submit" the info is taken and put into slot 'i' of the array.

    also, i'm using a submit button input type... just out of interest, what exactly happens with the "submit" button, what does it do with all the data on the form... coz so far i've just assigned an on-click tag that points to a method! just wondering if it has a default action that does something!

  2. #2
    Nigel McFarlane is offline Former moderator, account closed
    Join Date
    Nov 2003
    I live on the 'net
    Set the right attributes on the<form> tag correctly to get submit to work.

    To put things in an array:

    var myarray = new Array();

    then in the handler:

    myarray[i] = this.value;

    to find out what number to use, loop through the array called this.parentNode.childNodes until this.parentNode.childNodes[i] == this.
    Nigel McFarlane, Author: "Firefox Hacks", "Rapid Application Development with Mozilla"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.