天敏t2增强版gt7 64位:JavaScript中让一个HTML控件变不可用或不可见的语句怎么表示

来源:百度文库 编辑:高考问答 时间:2024/05/10 13:08:44
用Button1.disabled =true;行吗?

不行呀!!
document.form1.button1.style.disabled=true;
才可以噢!~试试看吧。

<input id="Button1" type="button" value="这是一个按钮"><br>
<input type=button onclick="Button1.style.display='none'" value="不可见">
<input type=button onclick="Button1.style.display=''" value="可见">
<input type=button onclick="Button1.disabled=true" value="不可用">
<input type=button onclick="Button1.disabled=false" value="可用">
<br><br>
<input type=button value="不可用" disabled>
<input type=button value="不可见" style="display='none'">

//点击隐藏<input type=button onclick="this.style.display='none'">
//不可以修改<input type=button disabled>

//用javascript

<script language="javascript">
function dis(){
document.all["button1"].disabled=true
}

function hid(){
document.all["button1"].style.display="none"
}
</script>

<input type=button name="button1" value="测试按钮">
<input type=button onclick="dis()" value="不可用">
<input type=button onclick="hid()" value="隐藏">

1。<input type=hidden name=hid value="">这个hidden能实现“不可见”。
2。<input type=button disabled=true value="">这个实现不可见
谢谢