原贴:http://community.csdn.net/Expert/topic/5035/5035660.xml?temp=.9632532function timediv()
{
  test.index.GetCount(GetCount_callback);  
  setTimeout("timediv()",1000)   
}
function GetCount_callback(res)
{
  document.getElementById("div1").innerHTML = res.value;
}
setTimeout("timediv()",1000)上面的是我改后可以使用的javascript部分问题:
test.index.GetCount(GetCount_callback)
这一句语法看起来不对啊,按习惯应该是
test.index.GetCount(GetCount_callback())  //但这样程序出错还有后台程序返回的过程明明是GetCount
但在javascript获取值的时候就变成了
function GetCount_callback(res)这是为什么test.index.GetCount(GetCount_callback)和function GetCount_callback(res)
的关系到底是什么谢谢大家的回答 谢谢

解决方案 »

  1.   

    http://www.ajaxpro.info/default.aspx?old=ajax
    这上面有一些例子,你好好看看~~
      

  2.   

    test.index.GetCount(GetCount_callback())  //但这样程序出错是不是因为GetCount_callback没有返回值?
      

  3.   

    回复:zhjg136(天星)
    上面的我改后是可以运行的程序
    但对里面写的语法很是不解
      

  4.   

    function1(callback) 变量相当要求一个委托
    function1( callback()) 变量是一个值
      

  5.   

    function timediv()
    {
      test.index.GetCount(GetCount_callback);  
      setTimeout("timediv()",1000)   
    }
    function GetCount_callback(res)
    {
      document.getElementById("div1").innerHTML = res.value;
    }
    setTimeout("timediv()",1000)GetCount_callback  -- 当请求成功 就调用此方法 这个名字跟后台没关系的
    你也可以这样写:
       var tmp = test.index.GetCount(GetCount_callback).value;  
       alert(tmp);