dh20156(风之石) ( ) 信誉:4  2006-08-01 22:45:00  得分: 0  
 
 
   建议使用异步方法调用数据。
  
 
同意俺twins的答案

解决方案 »

  1.   

    Javascript是单线程的,某些多线程其实还是基于单线程的模拟“多线程”,所以IE某行指令未执行完成,是无法再接受其他指令的。
      

  2.   

    var strNewMsg=ajaxshow.GetNewMsgString().value;
    ----------------------------------------------------
    这里面是怎么写的?
    贴出来一下,大家才好帮你改.
    估计是你的Ajax没有指定异步的参数
      

  3.   

    偶的天气预报:
    // Initialize
    function ajaxInitRV(){
    try
    {
    reqRV = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
    try
    {
    reqRV = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch(oc)
    {
    reqRV = null;
    }
    } if(!reqRV && typeof XMLHttpRequest!="undefined")
    {
    reqRV=new XMLHttpRequest();
    }
    }//获得天气预报资料
    function getWeather(){
    var url = "weather.asp";
    var ajaxRVA = null;
    var tempStr = null;
    ajaxInitRV();
    if(reqRV != null)
    {
    reqRV.onreadystatechange = function() {
    if (reqRV.readyState == 4) {
    if (reqRV.status == 200) {
    ajaxRVA = reqRV.responseText.split(",");
    tempStr = "<table width=\"100%\" border=\"0\">";
    tempStr += "<tr><td width=\"60\" class=\"dhWeatherCity\">"+ajaxRVA[1]+"</td><td class=\"dhWeatherData\">"+ajaxRVA[2]+"</td></tr>";
    tempStr += "<tr><td width=\"60\"><img src=\"images/weather/tem1.gif\" style=\"margin:0px;\"></td><td class=\"dhWeatherData\">"+ajaxRVA[3]+"</td></tr>";
    tempStr += "<tr><td width=\"60\"><img src=\"images/weather/tem2.gif\" style=\"margin:0px;\"></td><td class=\"dhWeatherData\">"+ajaxRVA[4]+"</td></tr>";
    tempStr += "<tr><td width=\"60\"><img src=\"images/weather/tem3.gif\" style=\"margin:0px;\"></td><td class=\"dhWeatherData\">"+ajaxRVA[5]+"</td></tr>";
    tempStr += "<tr><td width=\"60\"><img src=\"images/weather/tem5.gif\" style=\"margin:0px;\"></td><td class=\"dhWeatherData\">"+ajaxRVA[6]+"</td></tr>";
    tempStr += "<tr><td width=\"60\">&nbsp;</td><td class=\"dhWeatherData\" align=\"right\"><a class=\"dhWeather\" href=\"w72.asp\" onclick=\"return ow(this,550,400);\">72小时预报&raquo;</a>&nbsp;</td></tr>";
    tempStr += "</table>"
    document.getElementById("dhWeather").innerHTML = tempStr
    }else{
    document.getElementById("dhWeather").innerHTML = "载入失败, <a href=\"javascript:void(getWeather(););\">重试</a> ?"
    }
    }
    }
    //异步加载
    reqRV.open("GET", encodeURI(url), true);
             reqRV.send();
    }
    }
      

  4.   

    我应该肯定是同步吧?我用的ajax.dll[Ajax.AjaxMethod()] public string GetNewMsgString()//获取新消息的html字符串
    {
    string strMsgHTML="";

    SqlConnection conn=new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
    SqlCommand cmd=conn.CreateCommand();
    cmd.CommandType=CommandType.StoredProcedure;
    cmd.CommandText="chat_getnew"; cmd.Parameters.Add("@username",UserName); conn.Open(); using(SqlDataReader dr=cmd.ExecuteReader())
    {
    while(dr.Read())
    {
    if(dr.GetString(1)!="")
    {
    strMsgHTML+=string.Format(
    "<span class='chatmsg' style='COLOR:#{0}'>{1}&nbsp;&nbsp;<b>{2}</b>&nbsp;{3}&nbsp;<b>{4}</b>&nbsp;{5}&nbsp;说:&nbsp;{6}&nbsp;&nbsp;&nbsp;&nbsp;</span><br>",
    dr.GetString(5),
    dr.GetSqlDateTime(7),
    dr.GetString(1),
    TestIsPublic(dr.GetBoolean(6)),
    TestYourself(dr.GetString(2)),
    dr.GetString(4),
    Replace_GTLT(dr.GetString(3))
    );
    }
    else
    {
    strMsgHTML+=string.Format("<span class='chatmsg' style='COLOR:#{0}'>{1}&nbsp;&nbsp;<b>{2}</b></span><br>",
    dr.GetString(5),
    dr.GetSqlDateTime(7),
    dr.GetString(3));
    }
    }
    }

    conn.Close(); SetMsgPos();

    return strMsgHTML;
    }
    用异步要怎么写?
      

  5.   

    在有的情况下kill可以实现,大多数情况是不行的。