解决方案 »

  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>
    <style type="text/css">
    #show{
    position:fixed;
    background-color:#333;
    opacity:.5;
    filter:alpha(opacity=50);
    width:100%;
    height:100%;
    top:0px;
    left:0px;
    padding:200px;
    display:none;
    }
    </style>
    <script type="text/javascript">
    function change(buttons,next,len,show){
    show.style.display='block';
    for(var i=0;i<len-1;i++){
    buttons[i].onclick=function(){
    next.value=this.value;
    show.style.display='none';
    }
    }
    buttons[i].onclick=function(){
    next.value='';
    show.style.display='none';
    }
    }
    function init(){
    var table=document.getElementById("do");
    var show=document.getElementById("show");
    var buttons=show.getElementsByTagName("input");
    var len=buttons.length;
    table.onclick=function(e){
    var a=e||window.event;
    var src=a.srcElement||a.target;
    if(src.type=='button'){
    var next=src.parentNode.nextSibling;
    while(!next.tagName){
    next=next.nextSibling;
    }
    next=next.firstChild;
    if(next.value){
    for(var i=0;i<len-1;i++){
    buttons[i].disabled=true;
    }
    buttons[i].disabled=false;
    }else{
    for(var i=0;i<len-1;i++){
    buttons[i].disabled=false;
    }
    buttons[i].disabled=true;
    }
    change(buttons,next,len,show);
    }
    }
    }
    window.onload=init;
    </script>
    </head><body>
    <table id="do">
    <tr>
         <td><input type="button" value="one"></td>
            <td><input type="text"></td>
        </tr>
        <tr>
         <td><input type="button" value="two"></td>
            <td><input type="text"></td>
        </tr>
        <tr>
         <td><input type="button" value="three"></td>
            <td><input type="text"></td>
        </tr>
    </table>
    <div id="show">
    <table>
         <tr>
             <td><input type="button" value="1"></td>
                <td><input type="button" value="2"></td>
                <td><input type="button" value="3"></td>
                <td><input type="button" value="4"></td>
                <td><input type="button" value="5"></td>
            </tr>
            <tr>
             <td><input type="button" value="6"></td>
                <td><input type="button" value="7"></td>
                <td><input type="button" value="8"></td>
                <td><input type="button" value="9"></td>
                <td><input type="button" value="x"></td>
            </tr>
        </table>
    </div>
    </body>
    </html>
    类似这样试试