文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>选中单选按钮组后,对应文本框才可用

选中单选按钮组后,对应文本框才可用

时间:2008-04-19  来源:klx

  选中单选按钮组后,对应文本框才可用,效果如图: 500)this.width=500;" border=0> 代码:  

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style>
input{border:1px solid #cccccc; background-color:expression((this.readOnly && this.readOnly==true)?"#f0f0f0":"")}
</style>
<SCRIPT Language="JavaScript">

function SetEnable() {
if (document.getElementById("rd1").checked)
{
  document.getElementById("txt1").readOnly = false;
  document.getElementById("txt2").readOnly = true;
  document.form1.txt1.focus();
  }
  else
  {
  document.getElementById("txt1").readOnly = true;
  document.getElementById("txt2").readOnly = false;
  document.form1.txt2.focus();
  }
}
</SCRIPT>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
  <p>
    <label>
<input type="radio" name="RadioGroup1" id="rd1" value="rd1" onclick="SetEnable()" />
单选</label>
    <input type="text" id="txt1" name="textfield" />
    <br />
    <label>
    <input type="radio" name="RadioGroup1" id="rd2" value="rd2" onclick="SetEnable()" />
单选</label>
    <input type="text" id="txt2" name="textfield2" />
    <br />
  </p>
</form>
</body>
</html>

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载