I'm using the following show/hide script. If a user clicks No, it will clear all checkboxes and radio buttons in the appropriate div.
Anyone know how I could make it so that any select boxes change back to the default (value=select), if a user clicks No? I'd that to add that functionality to this existing script.
Thanks so much
Rick
--------------------------------------------------------
<input type="radio" name="Leader7" id="LeaderYes7" value="yes" onFocus="showlayer('LeaderQuestion_7');return true;"/>
<input type="radio" name="Leader7" id="LeaderNo7" value="no" onFocus="hidelayer('LeaderQuestion_7');return false;"/>
--------------------------------------------------------
function showlayer(whichLayer) {
document.getElementById(whichLayer).style.display = 'block';
}
function hidelayer(whichLayer) {
document.getElementById(whichLayer).style.display = 'none';
//Clear all Radio and Checkboxes when clicking No
var d = document.getElementById(whichLayer);
var e = d.getElementsByTagName("input");
for ( var i = 0; i < e.length; i++ ) {
if( e.type == "checkbox" || e.type == "radio" )
e.checked = false;
}
}
Anyone know how I could make it so that any select boxes change back to the default (value=select), if a user clicks No? I'd that to add that functionality to this existing script.
Thanks so much
Rick
--------------------------------------------------------
<input type="radio" name="Leader7" id="LeaderYes7" value="yes" onFocus="showlayer('LeaderQuestion_7');return true;"/>
<input type="radio" name="Leader7" id="LeaderNo7" value="no" onFocus="hidelayer('LeaderQuestion_7');return false;"/>
--------------------------------------------------------
function showlayer(whichLayer) {
document.getElementById(whichLayer).style.display = 'block';
}
function hidelayer(whichLayer) {
document.getElementById(whichLayer).style.display = 'none';
//Clear all Radio and Checkboxes when clicking No
var d = document.getElementById(whichLayer);
var e = d.getElementsByTagName("input");
for ( var i = 0; i < e.length; i++ ) {
if( e.type == "checkbox" || e.type == "radio" )
e.checked = false;
}
}