Jump to content

Recommended Posts

I have two radio buttons. each has its own relevant content which i want to display when one of the radio buttons is selected. I am using a simple javascript, however I don't see any effect, all the content remains displayed irrespective of the selection of the radio buttons. I have checked that other javascripts are working fine on the browser implying javascript is enabled.

 



<html>
<head>
<script language=javascript>
function formshowhide(id)
{
if(id == "quote")
{
document.getElementById('quotef').style.display = "block";
document.getElementById('otherf').style.display = "none";
}
else
{
document.getElementById('quotef').style.display = "none";
document.getElementById('otherf').style.display = "block";
}
}
</script>

</head>
<body><table>
<tr><td>Choose the prediction method:<label><input type="radio" name ="algo" value="SVM" checked="checked" onClick="formshowhide('quote')">SVM</label><label><input type="radio" name ="algo" value="ANN" onClick="formshowhide('other')">ANN</label>
</td></tr>
<div id="quotef">

<tr><td>Threshold  
<select name="thresh">
  <option value='1.0'>1.0</option>
  <option value='0.9'>0.9</option>
  <option value='0.8'>0.8</option>

</select>
</td></tr></div>
<div id="otherf" style="display:none;">

<tr>
<td> Thresholdscore  
<select name="anresh">
  <option value='1.0'>1.0</option>
  <option value='0.9'>0.9</option>
  <option value='0.8'>0.8</option>
</select>
</td></tr>
<tr><td valign='top'>
<b><br>etwork based on:</b></td>
<td width=50% valign=''>
<input type= "checkbox" value="1" name="dpcnet" checked disabled>Composition  


</td>
</tr>
<tr><td><hr SIZE="3" width=100%></td><td><hr SIZE="3" width=100%></td><td><hr SIZE="3" width=100%></td></tr>
</div>
</table>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/199100-hideshow-divs-radio-buttons/
Share on other sites

You are correct. What you actually wanted was to use the <tbody> tag. Wrap that around your table rows (<tr>) and you'll get what you're looking for, but don't use display 'block' for a tbody. Instead, use 'table-row-group,' and you can still use 'none.'

 

Here's a good reference:

http://www.w3schools.com/css/pr_class_display.asp

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.