How to make onClick radio button redirect

Can anybody explain to me how to rewrite the JavaScript below.

What the script below does is when you click the radio button it redirects the user to another page.

I used an old version of Dreamweaver to generate the code. It works ok the way it is but I need to make it simple enough so I can understand it a little better.

Dreamweaver makes JavaScript seem more complicated that it actually is. Is there any kind of tutorial and someone can direct me to?

<script language="JavaScript">
<!--
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>



<input type="radio" name="radiobutton" value="first" onClick="MM_goToURL('parent','/register/TestJS.html');return document.MM_returnValue">

Thanks.

Dreamweaver makes JavaScript seem more complicated that it actually is.
Yes. A lot of people on javascript forums, including me, won’t even look at Dreamweaver code.

Is there any kind of tutorial and someone can direct me to?
Javascript is widely documented on the net, and there are literally thousands of tutorials. You can search google.

However, what you want to do is as simple as this:

onclick = "document.location.href='somepage.htm'"

7stud;

It works great! Thanks for the help.

I did a search on the SitePoint JS forum a little earlier and found similar code. I tried it but it didn’t work. But what I earlier forgot to do - I didn’t put the onclick code inside <form> tags. No wonder it wouldn’t work. :blush:

Thanks again for the help.

It’s also valid markup to put a radio button input inside an anchor tag sporting a href.

Hi, there. I’m trying to put a radio button input inside an anchor tag with its href, like you guys suggested, but even though the browser shows the url at the bottom when the mouse is on the radio button, it doesn’t redirect when it’s clicked.

The onclick = “document.location.href=‘somepage.htm’” works fine, but…can it redirect while sending a jsp parameter to the destination document at the same time?

Since I’m coding on xhtml and trying to send a parameter from the .jsp document where the clicked radio button is on to another .jsp document, I’m not sure if it’s better not to use any JavaScript based code, like the “onclick”, and do everything xhtml, html and jsp instead. That’s why I’m interested in the “<a href…” option.

Has anyone tryed successfully to redirect a radio button without any JavaScript? Is there any way of doing it in html, xhtml and jsp only?

Thank you in advance for any hint or help.

Héctor.

onclick="location.href='somepage.htm?myvar=myval&amp;myvar2=myval2'"