0

Hello, I have this code:

<select name="product" class="buy">
                  <option value="products.php" selected>Select Term</option>
                  <option value="products.php?item=1&term=1">2 Month</option>
                  <option value="products.php?item=1&term=3">3 Months</option>
                  <option value="products.php?item=1&term=6">4 Months</option>
                  <option value="products.php?item=1&term=12">5 Months </option>
                </select>

I need to make it so as soon as you click that select box, it loads the url (value)... if anyone can help me that would be great!

2
Contributors
3
Replies
5
Views
11 Years
Discussion Span
Last Post by tgreer
0

Thanks for your help.Here's my code again:

<select name="product" class="buy">
                  <option value="products.php" selected>Select Term</option>
                  <option value="products.php?item=1&term=1">2 Month</option>
                  <option value="products.php?item=1&term=3">3 Months</option>
                  <option value="products.php?item=1&term=6">4 Months</option>
                  <option value="products.php?item=1&term=12">5 Months </option>
                </select>

When they click the "2 Month" value, it will load http://www.mydomain.com/products.php?item=1&term=1. Do you see what I'm trying to do? Thanks

0

Sure. Add on onChange handler:

<select name = "product" class="buy" onChange="JavaScript:mySelect(this);">

Code the mySelect function in the head/script section:

function mySelect(x)
{
  window.location.href = "http://www.your_domain.com/"  +   
     x.options[x.selectedIndex].value;
}

Some variation of that ought to do the trick.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.