setAttribute和removeAttribute不適用於Chrome並且Firefox只能在IE中使用。setAttribute和removeAttribute在Chrome和Firefox中不起作用
下面的代碼是在IE中正常工作,不與任何其他exploerer工作
<head>
<script type="text/javascript">
function showUser2()
{
buttonpassvalue1.setAttribute("disabled","disabled");
buttonpassvalue.removeAttribute("disabled");
}
</script>
</head>
<button class="button" type="button" name="buttonpassvalue1" value="1" onclick="showUser2(this.value)">This will Disbale</button>
<button class="button" type="button" name="buttonpassvalue" value="-1" onclick="showUser2(this.value)">Press This</button>
其終止時達到上面的代碼
感謝您的幫助
發佈一個完整的示例。 – Blender
'setAttribute'在IE8中對我來說沒有定義。 「buttonpassvalue」和「buttonpassvalue1」是什麼類型的對象? – jasonscript
@Blender我改變了上面的代碼,請在IE,Chrome,Opera,Mac,Firefox中嘗試一下.....只適用於IE –