-1
我已經編寫了一些簡單的代碼,可以使按鈕單擊時啓用和禁用輸入字段,但它沒有響應。 請幫我... !!!使用Javascript啓用和禁用輸入字段
<html>
<head>
<script type="text/javascript">
function toggleEnable(el1, el2) {
document.getElementByID(el1).disabled = true;
document.getElementByID(el2).disabled = true;
}
</script>
</head>
<body>
<form>
<table>
<tr>
<td><input id="input1" class="myText" type="text" placeholder="Row 1" /></td>
<td><input id="input2" class="myText" type="text" placeholder="Row 1" /></td>
<td><button onclick="toggleEnable('input1','input2')"> Enable/Disable </button></td>
</tr>
<tr>
<td><input id="input3" class="myText" type="text" placeholder="Row 3" /></td>
<td><input id="input4" class="myText" type="text" placeholder="Row 4" /></td>
<td><button onclick="toggleEnable('input3','input4')"> Enable/Disable </button></td>
</tr>
</table>
</form>
</body>
</html>
可能重複http://stackoverflow.com/questions/2874688/how-to-disable-an-inpu噸型文本 – FrEaKmAn