I am trying to hide some content when a radio button is changed. I have been searching the internet for this, but the only thing I found that is close to what I wanted was done in .asp. I tried to convert it, but seeing I do not know Javascript very well, I was unsuccessful. I’m hoping someone here can help me set it right.
[CODE]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta content=”text/html; charset=utf-8″ http-equiv=”Content-Type” />
<title>Untitled 1</title>
<script language=”javascript”>
window.onload=function(){
var rb = document.getElementsById(‘opt0’);
var d = document.getElementById(‘dvArea’);
if (rb.checked == true) {
d.style.visibility = “visible”;
}
else {
d.style.visibility = “hidden”;
}
};
</script>
</head>
<body>
<form id=”frmOptions”>
<input type=”radio” name=”options” id=”opt0″ checked=”checked” />
<label for=”opt0″>Option 1</label>
<input type=”radio” name=”options” id=”opt1″ />
<label for=”opt1″>Option 2</label>
</form>
<div id=”dvArea”>
Some contents
</div>
</body>
</html