Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New Coder
    Join Date
    Sep 2003
    Location
    sunny england
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question how do I add a target in a dynamic pull down menu?

    My Page so far - pulldown.html

    Using the dynamic pull down menu page on javascriptkit (http://www.javascriptkit.com/howto/pulldown.shtml ) I am trying to use the first pulldown down box(which asks the user which season they are booking in) to alter the second one (which asks how many weeks, which are different prices depending on the season) and then rather than being directed to a page, it brings a price up in a text box, however in the dynamic pull down script I am using at the moment I do not know where to put the target to bring up the price in a text box, the code for the current array i have is as below :

    var info = new Array(
    "High Season2003*1 Weeks3|2 Weeks|3 Weeks|4 Weeks|5 Weeks",
    "High Season2004*1 Weeks4|2 Weeks|3 Weeks|4 Weeks|5 Weeks",
    "Mid Season2004*1 WeeksM|2 Weeks|3 Weeks|4 Weeks|5 Weeks",
    "Low Season*1 WeeksL|2 Weeks|3 Weeks|4 Weeks|5 Weeks"

    however I need to put the following information in for the weeks:

    <select name="qtyA" size="1" onchange="return showPrice(this,'HIGH2004')" style="width:120px;">
    <option value="0" selected="selected">Please Select</option>
    <option value="1">1week</option>
    <option value="2">2weeks</option>
    <option value="3">3weeks</option>
    <option value="4">4weeks</option>
    <option value="5">5weeks</option>
    </select>

    does anyone know if this is possible?

  • #2
    Regular Coder Vincent Puglia's Avatar
    Join Date
    Jul 2003
    Location
    where the World once stood
    Posts
    367
    Thanks
    0
    Thanked 13 Times in 13 Posts
    Hi,

    would this help?

    if your form looks like this:

    sel1 sel2 txt1

    sel2's tag should look like:

    <select ....onchange="fillTextBox(this.options[this.selectedIndex].value)">
    <option value='$9.99'>Atari 1200</option>

    Vinny
    Where the world once stood
    the blades of grass
    cut me still

  • #3
    New Coder
    Join Date
    Sep 2003
    Location
    sunny england
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Vincent, thats exactly what I was looking for, thanks very much for your help!

  • #4
    Regular Coder Vincent Puglia's Avatar
    Join Date
    Jul 2003
    Location
    where the World once stood
    Posts
    367
    Thanks
    0
    Thanked 13 Times in 13 Posts
    Glad you like it

    sometime next week, it should be at the main site:

    http://members.aol.com/grassblad

    with explanations and other features

    Vinny
    Where the world once stood
    the blades of grass
    cut me still

  • #5
    New Coder
    Join Date
    Sep 2003
    Location
    sunny england
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    consider your site bookmarked i look forward to learning more (speaking as a complete javascript novice!) as I cant seem to get the final total to appear in the text box.. here is how far I got, is there something I've done wrong along the way?

    thanks vinny

  • #6
    Regular Coder Vincent Puglia's Avatar
    Join Date
    Jul 2003
    Location
    where the World once stood
    Posts
    367
    Thanks
    0
    Thanked 13 Times in 13 Posts
    Hi billy,

    ...wrong along the way?
    Well, in your case you really don't need a fillTextBox function.
    This should do the trick:

    <select name="items" onchange="this.form['Total'].value = this.options[this.selectedIndex].value">

    Vinny
    Where the world once stood
    the blades of grass
    cut me still

  • #7
    New Coder
    Join Date
    Sep 2003
    Location
    sunny england
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi thanks Vinny, I have that bit working now, but have spent the last half a day trying to get the total from the dynamic pull down menu form to be added into the grand total along with other calculations on the page, if you need to see what I'm talking about, what I've got so far is here but all I seem to be getting is errors
    any ideas if or how its fixable?

    thanks

  • #8
    Regular Coder Vincent Puglia's Avatar
    Join Date
    Jul 2003
    Location
    where the World once stood
    Posts
    367
    Thanks
    0
    Thanked 13 Times in 13 Posts
    Hi billy,

    why not the same way you do everything else? append your call to 'showprice' to the original onchange:
    onchange='...xtotal=this.value.... ; showprice(...)'

    or call a function with the onchange that does both:
    onchange=doit(.....)
    function doit(....)
    {
    ...xtotal = ....
    ...pricetotal +=.....
    }


    Vinny
    Where the world once stood
    the blades of grass
    cut me still

  • #9
    New Coder
    Join Date
    Sep 2003
    Location
    sunny england
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    the first second looks good, but I doubt my ability to know all the code to write the function and where to put it!

    hmm .. maybe I should learn some more about javascript?

  • #10
    Regular Coder Vincent Puglia's Avatar
    Join Date
    Jul 2003
    Location
    where the World once stood
    Posts
    367
    Thanks
    0
    Thanked 13 Times in 13 Posts
    www.htmlgoodies.com -- tutorials
    javascript in 25 hours -- book
    Where the world once stood
    the blades of grass
    cut me still


  •  

    Posting Permissions

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