点一个按钮的时候,先进入函数A,
A为true,执行函数B;   
A为false,执行函数C,执行函数C后,为true,执行函数B。
在按钮触发里面,该如何写呢?
onClientClick = "A();B();C();";现在是这样,肯定不行了。

解决方案 »

  1.   

    业务逻辑都搞不清,不知道你怎么学的
    onClientClick = "A(true);";
    函数A(bool)
    {
    if(bool)
        B();
    else{
       var value = C();
       if(value)
         B();
    }
    }函数B()
    函数C()
      

  2.   

    <script type="text/javascript">
        function A()
        {
            if(...){//如果为true;
                B();
            }
            else if(C()){//如果为false并且C()返回true;
                B();
            }
        }
        function B()
        {
            //您的代码
        }
        function C()
        {
            if(...){
                return true;
            }
            else{
                return false;
            }
        }
    </script>
      

  3.   

    可先写一个函数D,来实现另外三个函数: 
         function D()
          {
              var flag = A();
      if(flag)
         B();
              else
              {   
                   var value = C();
    if(value)
       B();
     }
           }onClientClick = "D()";
      

  4.   

    看来还能混点分。最佳的方案是采用事件监听机制:
    function addEventHandler(target, type, func) {
    if (target.addEventListener)
    target.addEventListener(type, func, false);
    else if (target.attachEvent)
    target.attachEvent("on" + type, func);
    else target["on" + type] = func;
    }var btn = document.getElementById("btn");
    addEventHandler(btn, "click", A);
    addEventHandler(btn, "click", B);
    addEventHandler(btn, "click", C);
      

  5.   

     If you attach multiple functions to the same event on the same object, the functions are called in random order, immediately after the object's event handler is called.
      

  6.   

    onClientClick = "A()? B(): (C()? B(): return;);"