选择不同的按钮输入不同的文字.htm

来自「javascript的功能特效。开发必备」· HTM 代码 · 共 23 行

HTM
23
字号
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>标题页</title>
<script language="javascript">
function chk(obj,txtIndex)
{
	var tmpInput = document.getElementsByName("textfield")[txtIndex];	//获取指定的文本框
	obj.checked?tmpInput.disabled=false:tmpInput.disabled=true;         //判断文本框是否处于选中状态
}
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
  <input name="che" type="checkbox" value="" onclick="chk(this,'0')"/>
  <input type="text" name="textfield" disabled=true /><BR/>
  <input name="che" type="checkbox" value="" onclick="chk(this,'1')"/>
  <input type="text" name="textfield" disabled=true /><BR/>
  <input name="che" type="checkbox" value="" onclick="chk(this,'2')"/>
  <input type="text" name="textfield" disabled=true /><BR/>
</form>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?