<html>
<head>
</head>
<body>
<input type="radio" id="yes" name="radio" onclick="show_hide('visible')" checked="checked"> Да
<input type="radio" id="no" name="radio" onclick="show_hide('hidden')"> Нет
<div id="element">
<input type="text" id="code">
</div>
<div>JavaScript</div>
<br>
<input type="button" value="Click" onclick="check();">
<script Language="JavaScript">
var Style='visible';
function show_hide(value){
Style=value;
document.getElementById('element').style.visibility = value;
}
function check() {
var code = document.getElementById('code');
if(Style=='visible'){if (code.value == ""){alert ("ERROR."); return;}
alert('ok');
}
}
</script>
</body>
</html>