100分求jquery判断句写法!<script>
  $(document).ready(function(){
     runIt();
   
  });
  
   function runIt() {
      $("div").animate({left:'+=200'},2000);
   $("div").animate({left:'-=200'},2000);
      $("div").hide("slow",runIt1);//在这里加个判断如果a>b 则执行runIt1,否则执行
                                   //runIt,a=<%=rs("a")%>,b=<%=rs("b")%>,这个判断句怎么写啊!!
     
    }

  function runIt1() {
      $("div").animate({left:'+=500'},2000);
   $("div").animate({left:'-=500'},2000);
      $("div").hide("slow",runIt);
     
    }


  </script>
  <style>
  div { margin:3px; width:40px; height:40px;
        background:green; }
    </style>

解决方案 »

  1.   

     <script>
      $(document).ready(function(){
         runIt();
       
      });
      
       function runIt() {
     $("div").show(1200);
          $("div").animate({left:'+=200'},2000);
       $("div").animate({left:'-=200'},2000);
          $("div").hide("slow",runIt1);
         
        }

      function runIt1() {
     $("div").show(1200);
          $("div").animate({left:'+=500'},2000);
       $("div").animate({left:'-=500'},2000);
          $("div").hide("slow",runIt);
         
        }


      </script>
      <style>
      div { margin:3px; width:40px; height:40px;
            position:absolute; left:0px; top:30px;
            background:green; display:none; }
      div.newcolor { background:blue; }
      span { color:red; }
      </style>完整的!问题//在这里加个判断如果a>b 则执行runIt1,否则执行
                                       //runIt,a=<%=rs("a")%>,b=<%=rs("b")%>,这个判断句怎么写啊!!
      

  2.   

    rs中 a, b是数字的话:
    ....
    var a = <%=rs("a").Value%>;
    var b = <%=rs("b").Value%>;
    $("div").hide("slow",a>b?runIt1:runIt);
      

  3.   

    var a = <%=rs("a").Value%>;
    var b = <%=rs("b").Value%>;
    var c = <%=rs("c").Value%>;
    var d = <%=rs("d").Value%>;
    ......
    假如a>b>c>d
    如过a最大,执行则执行runIt1,否则执行 runIt
      

  4.   


    var a = [<%=rs("a").Value%>, <%=rs("b").Value%>, <%=rs("c").Value%>, <%=rs("d").Value%>];
    var b = true;
    for(var i=1;i<a.length;i++){
       if(a[i] > a[0]) {b = false; break;}
    }
    $("div").hide("slow",b?runIt1:runIt);