...

View Full Version : Javascript Radio Button value retrieval question



FatherShark
10-23-2005, 08:13 AM
Hi guys - I am working on a menu using radio buttons on the left handed side of a frameset, and I cannot get it to work. Any help or advice would be muchly appreciated - I am going mad!!!

Regards,

Justin


<html>
<head>

<script type="text/javascript">
function go()
{
var goto="none";
if (document.nav.link[0].checked)
goto=nav.link[0].value;
if (document.nav.link[1].checked)
goto=nav.link[1].value;
if (document.nav.link[2].checked)
goto=nav.link[2].value;

parent.rightframe.location=document.getElementById(goto).value;
}
</script>

</head>
<body>

<form name="nav" id="nav">
<input type="radio" name="link" value="cit.html"/>CIT<br />
<input type="radio" name="link" value="currency.html"/>Currency<br />
<input type="radio" name="link" value="survey.html"/>Staff Survey<br />
<input type="radio" name="link" value="game.html"/>Game<br /><br />
</form>


<input type="button" value="Go" onClick="go();"/>

</body>
</html>

vwphillips
10-23-2005, 05:04 PM
change

parent.rightframe.location=document.getElementById(goto).value;

to

parent.rightframe.href=document.getElementById(goto).value;

till I have time to look at this properly

Mr J
10-23-2005, 05:11 PM
Change

parent.rightframe.location=document.getElementById(goto).value;


to

parent.rightframe.location=goto

I would also change the words go and goto because they may be reserved words

felgall
10-23-2005, 09:42 PM
goto is a reserved word so you can't use it.

go is not reserved but has special meanings that will not be available if you use it as a field name.

FatherShark
10-27-2005, 12:52 AM
thank you all very much for your help, I appreciate it. I now have the problem licked.

nickbunyun
07-24-2008, 09:12 PM
i need help with the same thing..
i changed his code..
but its not working..

any help?

Mr J
07-25-2008, 08:58 PM
If you post your code we may be able to help



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum