SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2002
    Posts
    161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Changing Text With JavaScript!

    Hi, I would like to know if you can do the following:

    I have a course enrolment form and when somebody selects a course from the HTML menu, is it possible to use javascript to automatically update the price field to match the correct course? If so, does the price field that gets updated need to be a text box or can it just be plain text that is dynamic to the course that is selected? THANK YOU!

    Kind regards!

    RichardN!

  2. #2
    + platinum's Avatar
    Join Date
    Jun 2001
    Location
    Adelaide, Australia
    Posts
    6,441
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you got an example of the page?

    basically, you can use a textbox, and when the button is clicked or onChange the box can update itself automatically, I dont think it's possible with plain text though

  3. #3
    SitePoint Zealot
    Join Date
    Sep 2002
    Posts
    161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sure do, https://www.homebaseexpo.com.au/newcourse.html

    Do you still think the onChange event is the best solution to work?

  4. #4
    + platinum's Avatar
    Join Date
    Jun 2001
    Location
    Adelaide, Australia
    Posts
    6,441
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    your australian as well, eh?

    do you know any javascript? basically, you just need to apply the price to the onChange event, and have say a function to read the result and then pass it to the total field.

    for example:

    Code:
    <script>
    
    course = 0;
    
    function calculate(form)
    {
      document.forms[0].elements[15] = ("$" + course);
    }
    
    </script>
    Code:
    onChange = 'course = 80;'
    I doubt it works it was rushed, but thats the general idea


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •