WEB Javascript Help plz

Discussion in 'OT Technology' started by brds, Jan 25, 2010.

  1. brds

    brds OT Supporter

    Joined:
    Jun 26, 2006
    Messages:
    17,642
    Likes Received:
    13
    Location:
    Atlanta
    I've got a page that uses javascript to show the users a horizontal slider to select a number 1 through 5. Beside the slider is a text box that shows them their actual number selection to one tenth of a number. Beside the actual numerical number, I would like to have the script automatically fill in another text box with what percent of the final weighted score came from each specific question... for example, if i have 10 questions total, each one would be 10% (duh). So, if on question 1, i slide the user up the scale 1/2 way, a 2.5 should show up in the numerical box and a 5% would show up in the percentage box.

    My question is this, is there a simple javascript command to figure out what value is in a textbox in a form (based off ID), manipulate it, and spit it back out to another text box (by ID)?

    Thanks :wavey:
     
  2. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    what slider are you using? since there is no html standard markup for such a control, the ability to get the value of the slider is going to depend on how it's implemented.
     
  3. brds

    brds OT Supporter

    Joined:
    Jun 26, 2006
    Messages:
    17,642
    Likes Received:
    13
    Location:
    Atlanta
    Slider.js
    implementation within .cfm file:
     
  4. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    christ, that is an ugly script. check for "n_value" by id, see what that gives you.... does it actually post a form param to the server that you currently check?
     
  5. brds

    brds OT Supporter

    Joined:
    Jun 26, 2006
    Messages:
    17,642
    Likes Received:
    13
    Location:
    Atlanta
    I managed to attach an onMouseUp to the scroller image that calls the function (updatePercents):


    Is that the correct way to increment numCheckBoxes? Because, for some reason, it's not working. If i simply set numCheckBoxes to a number it'll work, but when I try to verify the box is checked and increment numCheckBoxes on a True return, it doesn't work.
     
    Last edited: Jan 26, 2010

Share This Page