Solved

Problem with radio button not checked in form

Posted on 2004-08-14
3
298 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 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

895 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now