?
Solved

Problem with radio button not checked in form

Posted on 2004-08-14
3
Medium Priority
?
320 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
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
Colosseo earned 2000 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Strategic internal linking is often considered an SEO power technique, especially for content marketing. Do you need to hire an SEO agency to optimize you internal linking? No, this article will help you understand the basics of internal linking and…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses
Course of the Month13 days, 22 hours left to enroll

807 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