1个回答
2013-09-04
展开全部
###demo code
<style type="text/css">
<!--
.on_off{background:#F39;color:#FFF;font-weight:bold;}
-->
</style>
<script type="text/javascript">
<!--
var btn_on_off=1;
window.onload=function(){
var on_off=document.getElementById('on_off');
on_off.onclick=function(){
inps=document.getElementsByTagName('input');
inps_len=inps.length;
for(var i=0;i<inps_len;i++){
if(inps[i].type=='button'){
if(btn_on_off){
inps[i].disabled=true;
}else{
inps[i].disabled=false;
}
}
}
if(btn_on_off){
btn_on_off=0;
this.value='总开关(开)';
}else{
btn_on_off=1;
this.value='总开关(关)';
}
this.disabled=false;
}
}
//-->
</script>
<input type="button" value="按钮01" />
<input type="button" value="按钮02" />
<input type="button" value="总开关(关)" id="on_off" class="on_off" />
<input type="button" value="按钮04" />
<input type="button" value="按钮05" />
<input type="button" value="按钮06" />
<style type="text/css">
<!--
.on_off{background:#F39;color:#FFF;font-weight:bold;}
-->
</style>
<script type="text/javascript">
<!--
var btn_on_off=1;
window.onload=function(){
var on_off=document.getElementById('on_off');
on_off.onclick=function(){
inps=document.getElementsByTagName('input');
inps_len=inps.length;
for(var i=0;i<inps_len;i++){
if(inps[i].type=='button'){
if(btn_on_off){
inps[i].disabled=true;
}else{
inps[i].disabled=false;
}
}
}
if(btn_on_off){
btn_on_off=0;
this.value='总开关(开)';
}else{
btn_on_off=1;
this.value='总开关(关)';
}
this.disabled=false;
}
}
//-->
</script>
<input type="button" value="按钮01" />
<input type="button" value="按钮02" />
<input type="button" value="总开关(关)" id="on_off" class="on_off" />
<input type="button" value="按钮04" />
<input type="button" value="按钮05" />
<input type="button" value="按钮06" />
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询