我的页面语言是ASPX(C#)的,在线等,谢谢

解决方案 »

  1.   

    你这样试下...
    <script type="text/javascript">
    function SetState(state)
    {
      switch (state)
      {
      case "预处理":  
       document.getElementById("btn1").src = "/image/admin_b1_g.gif";
       document.getElementById("btn1").onclick = null;
       document.getElementById("btn2").src = "/image/admin_b2.gif";
       document.getElementById("btn2").onclick = function(){SetState('配货中');};
       break;
      case "配货中":  
       document.getElementById("btn1").src = "/image/admin_b1.gif";
       document.getElementById("btn1").onclick = function(){SetState('预处理');};
       document.getElementById("btn2").src = "/image/admin_b2_g.gif";
       document.getElementById("btn2").onclick = null;
       break;
      }
    }
    </script>
    <img id="btn1" src="/image/admin_b1.gif" onclick="SetState('预处理')" style="cursor: hand" />
    <img id="btn2" src="/image/admin_b2.gif" onclick="SetState('配货中')" style="cursor: hand" />
      

  2.   


    <!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>
        <title></title>
         <SCRIPT>
             function runThing() {
                 alert("123");
             }
             function add() {
                 var obj = document.getElementById("btnRun");
                 obj.onclick = function() {
                     runThing();
                 }
             }
             function del() {
                 var obj = document.getElementById("btnRun");
                 obj.onclick = function() {
                 }
             }      
     </SCRIPT></head>
    <body>
        <input  onclick="add();" type="button" value="给按钮加事件" />
        <input  onclick="del();" type="button" value="给按钮去事件" />
        <br />
        <hr />
        <br />
        <input id="btnRun" type="button" value="button" />
    </body></html>