做的一个网站有个搜索功能,如果没有搜索到信息的话,返回到index.jsp页面,并且弹出qq信息框, 可是它显示的效果是不返回index.jsp页面了   直接在父窗口打开了http://b4.qq.com/webc.htm?new=0&sid=4008269999&eid=&o=&q=7&from=qqwpa这个页面 ,<s:if test="#request.searchlist.list.size()==0">没有您要找的信息!
  <a id="go_title ">
<script>
  var time = 0;
  function gotoBbsIndex() {
    time++;
    if (time == 4) {
document.location.href = "index.jsp ";
  }
  document.getElementById("go_title ").innerHTML = (4 - time)+ "秒后自动打开客服QQ";
}
window.setInterval("gotoBbsIndex() ", 1000);
       </script>
  </a>
  <% response.setHeader("refresh","3;URL=http://wpa.qq.com/msgrd?v=3&uin=4008269999&site=qq&menu=yes") ;%> 
</s:if>求指教!!!!!

解决方案 »

  1.   

    alert() 一下,看看document.location.href = "index.jsp ";
    这句代码执行没好像应该写成window.location.href啊!!!给忘了,location应该在window下!
      

  2.   

    在哪调用的 gotoBbsIndex() 这个呀
      

  3.   

    window.onload=function(){
       setInterval(function(){
          if (time == 4) {
            self.location = "index.jsp ";
          }
          document.getElementById("go_title ").innerHTML = (4 - time)+ "秒后自动打开客服QQ";
        }
        time++;   }, 1000);
    }
      

  4.   


    貌似判断time==4这里有问题
      

  5.   

    我如果把response.setHeader("refresh","3;URL=http://wpa.qq.com/msgrd?v=3&uin=4008269999&site=qq&menu=yes")    放到if(time==4)里边,返回首页就能执行  但是   打开QQ聊天窗口就不执行了
      

  6.   


    那你做个判断就行了啊,如果返回的的数据为null:
    window.onload =function(){
       if(data==null){
          setTimeout(........){}
       }
    }