dhtml0.html 1.17 KB
<?xml version="1.0" encoding="utf-8"?>
<!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 http-equiv="content-type" content="text/html;charset=utf-8" />
<title>DHTMLサンプル</title>
<script language="javascript" type="text/javascript">
  function radioChange() {
    if(document.form1.radio1[0].checked == true) {
      document.form1.text1.disabled = false;
      document.form1.text1.style.backgroundColor='#FFFFFF';
    } else if(document.form1.radio1[1].checked == true) {
      document.form1.text1.disabled = true;
      document.form1.text1.style.backgroundColor='#D4D0C8';
    } else {
      document.form1.text1.disabled = false;
      document.form1.text1.style.backgroundColor='#FFFFFF';
    }
  }
</script>
</head>
<body bgcolor="#ffffff" onload="radioChange()">

<form name="form1"> 
  <input type="radio" name="radio1" value="1" onclick="radioChange()" />有効 
  <input type="radio" name="radio1" value="0" onclick="radioChange()" />無効 
  <input type="text" name="text1">
  <input type="submit" value="送信" /> 
</form>

</body>
</html>