codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Javascript Radio Button value retrieval question  FatherShark at 08:06 on Sunday, October 23, 2005
 

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.

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>

  Re: Javascript Radio Button value retrieval question  mystryd at 09:33 on Friday, October 28, 2005
 

I just solved a similar problem myself
(after hoping your post would have an answer!)

Instead of this:
if (document.nav.link[0].checked)

try:
if (document.nav.link[0].checked == true)


Good Luck!


P.S. I came upon this by first putting the value
into an alert:
alert("hey: " + document.nav.link[0].checked);









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: sorting and Linked list
•  Re: need help linked list
•  Re: Help with arrays
•  Re: Reading from a file
•  Re: Why Use Method?
•  Re: Help with a simple program
•  Re: need help with quiz
•  Re: Help with filesystem object & displaying in a table
•  Re: Genetic Algorithm Help


Recent Articles
Multiple submit buttons with form validation
Understanding Hibernate ORM for Java/J2EE
HTTP screen-scraping and caching
a javascript calculator
A simple way to JTable
Java Native Interface (JNI)
Parsing Dynamic Layouts
MagicGrid
Caching With ASP.Net
Creating CSS Buttons


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005