<script></script>
<style>
.td1{
     BACKGROUND-COLOR: #FFB84D;
    }
.td2{
     BACKGROUND-COLOR: #cccccc;
    }
</style>
<input type="button" name="b1" value="按钮A" class="td2" onclick="this.className='td1'">
<input type="button" name="b2" value="按钮B" class="td2" onclick="b1.className='td2'">

解决方案 »

  1.   

    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <style>
    .start {color:ff0000; background:c8ff4e} </style>
    </head>
    <body bgcolor="#83E09C">
    <input type=button id=gua onclick="this.className='start'" value=button>
    <input type=button name=guagua value="another button" onclick="gua.className=''">
    </body>
    </html>
      

  2.   

    按下A,A就变颜色,按下B,B变颜色的同时A恢复原来的,怎么实现
      

  3.   

    <script language=javascript>
    function on_click(a)
    {
    for(i=1;i<3;i++)
    {
    eval("form01."+"b"+i+".className='td2'");
    }
    eval("form01."+"b"+a+".className='td1'");
    }

    </script>
    <style>
    .td1{
         BACKGROUND-COLOR: #FFB84D;
        }
    .td2{
         BACKGROUND-COLOR: #cccccc;
        }
    </style>
    <form name=form01>
    <input type="button" name="b1" value="按钮A" onclick="on_click(1)">
    <input type="button" name="b2" value="按钮B"  onclick="on_click(2)">
    </form>
      

  4.   

    <html>
    <body>    <input id=a1 value=a1 type=button backupcolor="" onclick='this.backupcolor=this.style.backgroundColor; this.style.backgroundColor="#123456"'>
        <input id=a2 value=a2 type=button onclick="a1.style.backgroundColor = a1.backupcolor;">
    </body>
    </html>