打DOTA输了一晚了,郁闷啊,睡不着,就写了个,不知道对不对...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
var oData = {
"A" : "0235",
"B" : "4",
"C" : "78",
"D" : "169"
};
var strSource = strDest = ABC = "";String.prototype.order = function(){
return this.split("").sort().join("");
};
function $(id){
return document.getElementById(id);
}
window.onload = function(){
for(var pro in oData){
strSource += oData[pro];
}
$("sValue").innerHTML = ABC = strSource.order();;

var btn = $("btnContainer").getElementsByTagName("input");
for(var i=0; i<btn.length; i++){
btn[i].onclick = function(){
this.isClick = !this.isClick;
var val = oData[this.id];
if(this.isClick){
strSource = strSource.replace(val, "");
strDest += val;
}else{
strSource += val;
strDest = strDest.replace(val, "");
}
$("sValue").innerHTML = ABC = strSource.order();
$("dValue").innerHTML = strDest.order();
};
}
};
</script>
</head><body>
<form id="form1" name="form1" method="post" action="">
<table width="400" border="1" align="center" cellpadding="5">
  <tr>
    <td width="50%" id="btnContainer">
      <input type="button" name="A" id="A" value=" A " />
      <input type="button" name="B" id="B" value=" B " />
      <input type="button" name="C" id="C" value=" C " />
      <input type="button" name="D" id="D" value=" D " />
    </td>
    <td><div id="sValue">&nbsp;</div></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><div id="dValue">&nbsp;</div></td>
  </tr>
</table>
</form>
</body>
</html>

解决方案 »

  1.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript">
    var oData = [ "0235", "4", "78", "169" ];
    var ABC = "";function $(selector){
        return document.getElementById(selector);
    }
    function $T(selector,context){
        return (context||document).getElementsByTagName(selector);
    }
    function init(){
        var allChar = '0123456789';
        var divShow = $('divShow'),divOp = $('divOp');
        var chks = $T('input',divOp),sps = $T('span',divOp),length = chks.length;
        var txtSource = $("txtSource"),txtRemove = $("txtRemove");    txtSource.value = allChar;    for(var i = 0; i<length; chks[i].value = sps[i].innerHTML = oData[i++])
            chks[i].onclick = filterString;    function filterString(){
            var str = this.value,ABC =txtSource.value,  strRemove = txtRemove.value;
            var reg = new RegExp(str.split('').join('|'),'g');
            if(this.checked){
                ABC = ABC.replace(reg,'');
                strRemove += str;
            }else{
                ABC += str;
                strRemove = strRemove.replace(reg,'');
            }
            txtSource.value = ABC = ABC.split('').sort().join('');
            txtRemove.value = strRemove.split('').sort().join('');
        }
    };
    window.onload = init;
    </script>
    </head><body>
    <div id="divShow"><input type="text" id="txtSource" size="12"><input type="text" id="txtRemove" size="12"></div>
    <div id="divOp">
        <input type="checkbox" id="" value=""><span></span>
        <input type="checkbox" id="" value=""><span></span>
        <input type="checkbox" id="" value=""><span></span>
        <input type="checkbox" id="" value=""><span></span>
    </div></body>
    </html>
    换个checkbox版的
      

  2.   

    TO Free_Wind22 ,zhaoxiaoyang 哈!多谢了!要24小时后才能增加送分额度,暂先各半吧,两位别嫌少