55 users online (1 members and 54 guests)  


  Results 1 to 2 of 2

Related

  1. how to stop javascript via another javascript    Forum: Javascript Forum
    Replies: 0
  2. Replies: 8
  3. Replies: 5
  4. Javascript / css    Forum: Javascript Forum
    Replies: 1
  5. JavaScript    Forum: Javascript Forum
    Replies: 2
  1. #1
    Replicada's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2008
    Posts
    3

    New to Javascript

    Okay this may sound new, or it may sound completely obvious.

    But im new to javascript in the sense that i usually stick to server side script.

    Heres my issue:

    Ive coded a dropdown box in html, that contains 10 values, here it is:

    Code:
    <select size="1" name="speed">
    <option value="100" selected>100%</option>
    <option value="90">90%</option>
    <option value="80">80%</option>
    <option value="70">70%</option>
    <option value="60">60%</option>
    <option value="50">50%</option>
    <option value="40">40%</option>
    <option value="30">30%</option>
    <option value="20">20%</option>
    <option value="10">10%</option>
    </select>
    Now, you may be askign right here, this guy is posting in the wrong forum, but no.

    What i want to do now is have the user submit a percentage to a processing php script, but i require javascript to act as a graphical display for the user, so they can actually see the calculation before submitting it.

    So i need to pass a php variable into javascript, then somehow use javascript to manipulate the users percentage choice, and multiply a said variable by the percentage shown.

    For example if the user chose 100%, and the variable current was 100. I would need javascript to dump a value 100, and 80 at a percentage choice of 80%.

    Is this possible in javascript, and how would i go about doing it thanks...

  2. #2
    crymari2's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2008
    Posts
    6

    Re: New to Javascript

    Quote Originally Posted by Replicada View Post
    Okay this may sound new, or it may sound completely obvious.

    But im new to javascript in the sense that i usually stick to server side script.

    Heres my issue:

    Ive coded a dropdown box in html, that contains 10 values, here it is:

    Code:
    <select size="1" name="speed">
    <option value="100" selected>100%</option>
    <option value="90">90%</option>
    <option value="80">80%</option>
    <option value="70">70%</option>
    <option value="60">60%</option>
    <option value="50">50%</option>
    <option value="40">40%</option>
    <option value="30">30%</option>
    <option value="20">20%</option>
    <option value="10">10%</option>
    </select>
    Now, you may be askign right here, this guy is posting in the wrong forum, but no.

    What i want to do now is have the user submit a percentage to a processing php script, but i require javascript to act as a graphical display for the user, so they can actually see the calculation before submitting it.

    So i need to pass a php variable into javascript, then somehow use javascript to manipulate the users percentage choice, and multiply a said variable by the percentage shown.

    For example if the user chose 100%, and the variable current was 100. I would need javascript to dump a value 100, and 80 at a percentage choice of 80%.

    Is this possible in javascript, and how would i go about doing it thanks...
    Yes, that's possible if I understood you correctly.

    Just put onsubmit handler for the form, and in handler, use ajax to put the value user chose to some div.

    But remember that page will be reloaded instantly, so there is a chance user won't notice the change made to page.



Tags for this Thread