dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: Spreadsheet like

  1. #1
    Join Date
    Jun 2009
    Posts
    1

    Question Spreadsheet like

    Hi,

    I would like to know if it is easy or difficult to do the next thing:
    I have a xhtml table, inside a form, where I have input values. I would like to have something similar to a spreadsheet, that when some input field is modified, some other fields are modified too. I'm using onkeyup(). But my problem is referencing the other fields because I haven't id attributes and the position of the nodes are different each time. Possibly this question is trivial, I'm new to Javascript, and any help or pointer in the right direction will be very useful.

    Thanks very much.

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Quote Originally Posted by kinunt View Post
    But my problem is referencing the other fields because I haven't id attributes and the position of the nodes are different each time.
    Those fields must have something unique (id), or something stable (position, DOM relationship) or something in common (same name, same class, same attribute...). It the last case, that something property must be univoque, that means it has to belong to all those elements, but only to them.

    Now... giving them the same class looks the most convenient way. If so, tell me and I will give you a crossbrowser function getElementsByClassName() (as you might know, IE does not support the native getElementsByClassName() method)

  3. #3
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    in HTML tables, rows have .rowIndex, and cells have .cellIndex ...

    combined with parentNode, row.cells[n], and table.rows[n], you can refer to any other cell without any special attribs.

    i would also highly recommend using direct javascript bindings to define relationships when the above will not suffice, instead if DOM attribs like class, which will be much slower to access.

    something like cell.related=[cell2,cell21,cell33];

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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



Recent Articles