Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with radio buttons

Status
Not open for further replies.

rry2k

Programmer
Jun 28, 2001
678
US
I need to create a page that will send a user to one of three different pages depending on which button is selected.
If I someone could help me with the code on this I would greatly appreciate it.

Thanks..Russ
 
Hi mate,

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
function link1()
{if (document.links.open)
location='function link2()
{if (document.links.open)
location='function link3()
{if (document.links.open)
location='</script>
<form name=&quot;links&quot;>
<input type=&quot;radio&quot; name=&quot;open&quot; onclick=&quot;link1()&quot;>Domain 1
<input type=&quot;radio&quot; name=&quot;open&quot; onclick=&quot;link2()&quot;>Domain 2
<input type=&quot;radio&quot; name=&quot;open&quot; onclick=&quot;link3()&quot;>Domain 3
</form>

Hope this helps Wullie

 
Is there a way of adapting this code so that the radio button picked can change the style sheet for the page to what the user would like it to be? (eg You could have three external style sheets using different colour backgrounds, fonts etc and the user could choose the colours they'd like to see the page use?).

Many thanks.
 
Julianne,
It is possible only for a page that will be loaded after the style is chosen with radio buttons.

You'll need javascript to write [tt]<link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;style_page1.css&quot;>[/tt] dynamically according to selection made.

To pass the value of selected radio button you have to use one of the methodes of passing the variables in URL and getting it from there.


So there are 4 steps:
1. pick up the value of selected radio button
2. pass it with url to another page
3. on a new page read the value passed
4. write style source according to the value passed

This seems to be the most easy way to do what you want.

good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top