按钮怎么交替变灰(不可用)啊!!! <input type="button" onclick="this.disabled=true;thisformsubmit();" /> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <input value="111111" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change1()" /><script>function change(e){e.disabled="disabled"}function change1(){document.getElementsByTagName("input")[0].disabled=""}</script> 看错要求了<input value="111111" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change(this)" /><script>var oo=truefunction change(e){if(oo==true){e.disabled="disabled";oo=falsee.id="ss"}else{document.getElementById("ss").disabled=""oo=true}}</script> <input id="a1" value="111111" type="button" onclick="change(this.id)" /> <input id="a2" value="222222" type="button" onclick="change(this.id)" /> <script> var objid;function change(e){ e.disabled="disabled" ;objid=e;objid.disabled="" ;} </script> <input id="a1" value="111111" type="button" onclick="change(this.id)" /> <input id="a2" value="222222" type="button" onclick="change(this.id)" /> <script> var objid;function change(e){ document.getElementById(e).disabled="disabled" ;objid=e;document.getElementById(objid).disabled="" ;} </script> <script>function test(obj){ for( var i=1;i<=2;i++ ){ document.getElementById("button"+i).disabled=false; if( obj == document.getElementById("button"+i) ) obj.disabled = true; }}</script> <input type="button" id="button1" value="ok1" onclick="test(this);"> <input type="button" id="button2" value="ok2" onclick="test(this);"> 给你点建议,如果比较多的按钮怎么办?难道你也都用FOR循环??都要遍历一遍? <input id="a1" value="111111" type="button" onclick="change(this.id)" /> <input id="a2" value="222222" type="button" onclick="change(this.id)" /> <script> var objid;function change(e){ document.getElementById(e).disabled="disabled" ;if(objid){document.getElementById(objid).disabled="" ;}objid=e;} </script>这个应该比较全面了 <input value="111111" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change(this)" /><script>var oo=truefunction change(e){if(oo==true){e.disabled="disabled";oo=falsee.id="ss"}else{document.getElementById("ss").disabled=""document.getElementById("ss").id=""oo=true}}</script>随手写的 bug多多 呵呵!! <script> var tmpObj;function test(obj){ obj.disabled = true; if(tmpObj)tmpObj.disabled = false; tmpObj = obj;} </script> <input type="button" id="button1" value="ok1" onclick="test(this);"> <input type="button" id="button2" value="ok2" onclick="test(this);"><input type="button" id="button3" value="ok3" onclick="test(this);"> 你的还是有问题oo=false了你再按按钮的时候根本无法执行if(oo==true){e.disabled="disabled";oo=falsee.id="ss"}这部分 恩 没仔细看需求<input value="111111" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change(this)" /><script>function change(e){if(document.getElementById("ss")!=null){document.getElementById("ss").disabled=""document.getElementById("ss").id=""}e.disabled="disabled";e.id="ss"}</script> 其实一个全局变量就解决问题了,哪里需要循环啊 <html> <head> <script type="text/javascript"> var num=0; function cl(e,id){ e.disabled="disabled"; if(num){ document.getElementById(num).disabled=""; } num=id; } </script> </head> <body> This is my HTML page. <br> <input type="button" value="button1" id="b1" onclick="cl(this,'b1')"/> <input type="button" value="button2" id="b2" onclick="cl(this,'b2')"/> <input type="button" value="button3" id="b3" onclick="cl(this,'b3')"/> <input type="button" value="button4" id="b4" onclick="cl(this,'b4')"/> <input type="button" value="button5" id="b5" onclick="cl(this,'b5')"/> <input type="button" value="button6" id="b6" onclick="cl(this,'b6')"/> <input type="button" value="button7" id="b7" onclick="cl(this,'b7')"/> </body></html> 谢谢大家的帮忙,尤其要谢谢chinmo ,呵呵 版主请进 jquery.datatables 如何自定义 某列宽度可拖拽? 怎样弹出2次确认框 js判断文本框输入的是否数字,若是小数,小数点后只能有一位数字 一句代码 怎样控制多行文本框的行数和最多输入字符数 show段网上来的代码,抛石引玉--js html实现 不同的窗口访问同一个弹出窗口的问题 关于javascript做伸缩菜单,却无法实现伸缩效果。 切换图片不能显示 请问一下jquery 怎么请求获取url请求的json数据 求个只能输入数字和小数的JS window.opener给前一网页传值时不支持框架吗?
<input value="222222" type="button" onclick="change1()" /><script>
function change(e){
e.disabled="disabled"
}
function change1(){
document.getElementsByTagName("input")[0].disabled=""
}
</script>
<input value="111111" type="button" onclick="change(this)" />
<input value="222222" type="button" onclick="change(this)" /><script>
var oo=true
function change(e){
if(oo==true)
{e.disabled="disabled";
oo=false
e.id="ss"
}
else
{
document.getElementById("ss").disabled=""
oo=true
}
}
</script>
<input id="a2" value="222222" type="button" onclick="change(this.id)" /> <script>
var objid;
function change(e){
e.disabled="disabled" ;
objid=e;
objid.disabled="" ;
}
</script>
<input id="a2" value="222222" type="button" onclick="change(this.id)" /> <script>
var objid;
function change(e){
document.getElementById(e).disabled="disabled" ;
objid=e;
document.getElementById(objid).disabled="" ;
}
</script>
function test(obj){
for( var i=1;i<=2;i++ ){
document.getElementById("button"+i).disabled=false;
if( obj == document.getElementById("button"+i) )
obj.disabled = true;
}
}
</script>
<input type="button" id="button1" value="ok1" onclick="test(this);">
<input type="button" id="button2" value="ok2" onclick="test(this);">
难道你也都用FOR循环??都要遍历一遍?
<input id="a2" value="222222" type="button" onclick="change(this.id)" />
<script>
var objid;
function change(e){
document.getElementById(e).disabled="disabled" ;
if(objid){
document.getElementById(objid).disabled="" ;}
objid=e;
}
</script>
这个应该比较全面了
<input value="222222" type="button" onclick="change(this)" />
<input value="222222" type="button" onclick="change(this)" />
<input value="222222" type="button" onclick="change(this)" />
<input value="222222" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change(this)" />
<input value="222222" type="button" onclick="change(this)" />
<input value="222222" type="button" onclick="change(this)" /><script>
var oo=true
function change(e){
if(oo==true)
{e.disabled="disabled";
oo=false
e.id="ss"
}
else
{
document.getElementById("ss").disabled=""
document.getElementById("ss").id=""
oo=true
}
}
</script>
随手写的 bug多多 呵呵!!
var tmpObj;
function test(obj){
obj.disabled = true;
if(tmpObj)tmpObj.disabled = false;
tmpObj = obj;
}
</script>
<input type="button" id="button1" value="ok1" onclick="test(this);">
<input type="button" id="button2" value="ok2" onclick="test(this);">
<input type="button" id="button3" value="ok3" onclick="test(this);">
if(oo==true)
{e.disabled="disabled";
oo=false
e.id="ss"
}
这部分
<input value="111111" type="button" onclick="change(this)" />
<input value="222222" type="button" onclick="change(this)" />
<input value="222222" type="button" onclick="change(this)" />
<input value="222222" type="button" onclick="change(this)" />
<input value="222222" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change(this)" />
<input value="222222" type="button" onclick="change(this)" />
<input value="222222" type="button" onclick="change(this)" /><script>
function change(e){
if(document.getElementById("ss")!=null)
{document.getElementById("ss").disabled=""
document.getElementById("ss").id=""}
e.disabled="disabled";
e.id="ss"}
</script>
<html>
<head>
<script type="text/javascript">
var num=0;
function cl(e,id){
e.disabled="disabled";
if(num){
document.getElementById(num).disabled="";
}
num=id;
}
</script>
</head>
<body>
This is my HTML page. <br>
<input type="button" value="button1" id="b1" onclick="cl(this,'b1')"/>
<input type="button" value="button2" id="b2" onclick="cl(this,'b2')"/>
<input type="button" value="button3" id="b3" onclick="cl(this,'b3')"/>
<input type="button" value="button4" id="b4" onclick="cl(this,'b4')"/>
<input type="button" value="button5" id="b5" onclick="cl(this,'b5')"/>
<input type="button" value="button6" id="b6" onclick="cl(this,'b6')"/>
<input type="button" value="button7" id="b7" onclick="cl(this,'b7')"/>
</body>
</html>