看代码<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>111111111111</title>
    <script src="js/jquery-1.7.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        function checkColor()
        {
            $("#Button2").css("background-color", "#00a0e9").delay(500).css("background-color", "#7ecef4");
         }
    </script>
</head><body>
    <input id="Button1" type="button" value="button"  onclick="checkColor()"/>
    <input id="Button2" type="button" value="button" /></body>
</html>实现停顿换色的效果 怎么不行啊?求教啊
那个delay(500) 没作用

解决方案 »

  1.   

    此方法只能适用在动画之间做延迟效果,你要实现如你的效果,需要用<!DOCTYPE html>
    <html>
    <head>
      <style>
    div { position: absolute; width: 60px; height: 60px; float: left; }
    .first { background-color: #3f3; left: 0;}
    .second { background-color: #33f; left: 80px;}
    </style>
      <script src="http://code.jquery.com/jquery-latest.js"></script>
    </head>
    <body>
      
    <p><button>Run</button></p>
    <input id="Button2" type="button" value="button" />
    <div class="first"></div>
    <div class="second"></div>
            
    <script>
        $("button").click(function() {
    $("#Button2").css("background","#00a0e9");
     setTimeout(function(){ $("#Button2").css("background","#7ecef4");}, 500);
        });
    </script></body>
    </html>