buttons question

B

barbaz

Hi, sorry for the stupid question.

I use this function to cause a select to choose an URL to reach:

function getURL()
{
box = document.forms[0].book_select;
destination = box.options[box.selectedIndex].value;
if (destination) location.href = destination;
}

I call it this way:

<select onChange='getURL()'>

passing an URL as a 'value'.

Once selected, js directly takes me to the desired page.

Now, I need to do a slightly different thing.

In the same form, before the select, I've 7 radio buttons, of course
with their specific 'value's.

This value should be in some way added as a GET parameter to the the URL
contained in the select value.

So, if in the select value we have an option with:
'http://www.yahoo.com/index.php?par1=3' I must append &par2=radioValue

Is there a way to do this? How? Thanks!
 
P

Paul Lautman

barbaz said:
Hi, sorry for the stupid question.

I use this function to cause a select to choose an URL to reach:

function getURL()
{
box = document.forms[0].book_select;
destination = box.options[box.selectedIndex].value;
if (destination) location.href = destination;
}

I call it this way:

<select onChange='getURL()'>

passing an URL as a 'value'.

Once selected, js directly takes me to the desired page.

Now, I need to do a slightly different thing.

In the same form, before the select, I've 7 radio buttons, of course
with their specific 'value's.

This value should be in some way added as a GET parameter to the the
URL contained in the select value.

So, if in the select value we have an option with:
'http://www.yahoo.com/index.php?par1=3' I must append &par2=radioValue

Is there a way to do this? How? Thanks!

Have you thought of putting
javascript get radio value
into Google?
 
D

David Mark

Hi, sorry for the stupid question.

I use this function to cause a select to choose an URL to reach:

function getURL()
{
box = document.forms[0].book_select;
destination = box.options[box.selectedIndex].value;
if (destination) location.href = destination;

}
The select element is for form input. Using it as a faux dropdown
menu is a bad idea.

To illustrate, navigate with this select, hit the back button and then
try to use the mousewheel to scroll the page. Also, keyboard-only
users and most mobile devices can only navigate to the first choice in
the select. Agents without script or with script disabled are
similarly stranded.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,150
Messages
2,570,853
Members
47,394
Latest member
Olekdev

Latest Threads

Top