Solved

Problem with radio button not checked in form

Posted on 2004-08-14
3
307 Views
Last Modified: 2012-08-14
Hi All,
 When click on option 2,3,4 form changed but radio button not check.
Any help appreciated.

<html>
<head>

<script language="javascript">


function showHide(n) {
var eles = document.getElementsByTagName("div");
for(i=0;i<eles.length;i++) {
document.getElementById(eles[i].id).style.visibility="hidden";
}
for(i=0;i<eles.length;i++) {
if (eles[i].id==n) {
document.getElementById(n).style.visibility="visible";
}

}


}
</script>




<style type="text/css"><!--
#hotelbox { position: absolute; top: 16px; left: 16px; width: 100px; height: 100px; visibility: visible }
#customtripbox { position: absolute; top: 148px; left: 217px; width: 100px; height: 100px; visibility: hidden }
#carbox { position: absolute; top: 50px; left: 16px; width: 100px; height: 100px; visibility: hidden }
#lastmindealsbox { position: absolute; top: 60px; left: 20px; width: 100px; height: 100px; visibility: hidden }


-->
</style>
</head>

<body>
<div id="hotelbox">
This is hotelbox </div>
<div id="customtripbox">
This customtripbox </div>
<div id="carbox">
This is carbox </div>
<div id="lastmindealsbox">
This is lastmindealsbox </div>

<br><br><br><br><br><br><br><br><br><br>
<form>
<input type="radio" value="hotelbox" onClick="showHide('hotelbox');" checked >Option 1 </a><br>
<input type="radio" value="customtripbox" onClick="showHide('customtripbox');">Option 2 </a><br>
<input type="radio" value="carbox" onClick="showHide('carbox');">Option 3 </a><br>
<input type="radio" value="lastmindealsbox" onClick="showHide('lastmindealsbox');">Option 4 </a><br>

</form>
</body>
</html>
0
Comment
Question by:dl2y
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
Colosseo earned 500 total points
ID: 11801489
Hi dl2y

You appear to be missing the name value for the radio buttons. Try using this code below instead...

<form>
<input type="radio" value="hotelbox" name="boxOptions" onClick="showHide('hotelbox');" checked >Option 1 </a><br>
<input type="radio" value="customtripbox" name="boxOptions" onClick="showHide('customtripbox');">Option 2 </a><br>
<input type="radio" value="carbox" name="boxOptions" onClick="showHide('carbox');">Option 3 </a><br>
<input type="radio" value="lastmindealsbox" name="boxOptions" onClick="showHide('lastmindealsbox');">Option 4 </a><br>

</form>

Regards

Scott
0
 

Author Comment

by:dl2y
ID: 11801789
Hi Scott,

It's working now. Thanks a lot

Regards,
0
 
LVL 15

Expert Comment

by:Colosseo
ID: 11801805
Hi dl2y

Np glad its working and thanks for the Grade

Regards

Scott
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Where can I find... 1 53
website rewamp 5 50
Code Manager | Snippits 2 65
PHP Web Development 6 28
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question