<SCRIPT language=javascript>   
function yx_bg(n) {   
 n.background="/skins/skin1/images/i_topselected.gif";    
 if (n==yx2) {   
  document.yxform.which.value="all";   
  document.yxform.keywords.value="输入商业机会";   
  document.yxform.keywords.style.color="#999999";   
  line2.style.display="none";   
  line1.style.display="none";   
  line0.style.display="";   
  line3.style.display="";   
  line4.style.display="";   
  line5.style.display="";   
  line6.style.display="";   
  yx1.background="";   
  yx3.background="";   
  yx4.background="";   
  yx5.background="";   
  yx6.background="";   
  yx7.background=""; 
  response.redirect "index.asp"; }   
 if (n==yx1) {   
  document.yxform.which.value="all";   
  document.yxform.keywords.value="商机名称";   
  document.yxform.keywords.style.color="#999999";   
  line2.style.display="";   
  line3.style.display="";   
  line4.style.display="";   
  line5.style.display="";   
  line6.style.display="";   
  line1.style.display="none";   
  line0.style.display="none";   
  yx2.background="";   
  yx3.background="";   
  yx4.background="";   
  yx5.background="";   
  yx6.background="";   
  yx7.background="";   
 }   
 if (n==yx3) {   
  document.yxform.which.value="productshow";   
  document.yxform.keywords.value="输入产品名称";   
  document.yxform.keywords.style.color="#999999";   
  line3.style.display="none";   
  line2.style.display="none";   
  line0.style.display="";   
  line1.style.display="";   
  line4.style.display="";   
  line5.style.display="";   
  line6.style.display="";   
  yx1.background="";   
  yx2.background="";   
  yx4.background="";   
  yx5.background="";   
  yx6.background="";   
  yx7.background="";   
 }   
 if (n==yx4) {   
  document.yxform.which.value="corporation";   
  document.yxform.keywords.value="输入公司名称";   
  document.yxform.keywords.style.color="#999999";   
  line4.style.display="none";   
  line3.style.display="none";   
  line2.style.display="";   
  line0.style.display="";   
  line1.style.display="";   
  line5.style.display="";   
  line6.style.display="";   
  yx1.background="";   
  yx3.background="";   
  yx2.background="";   
  yx5.background="";   
  yx6.background="";   
  yx7.background="";   
 }   
 if (n==yx5) {   
  document.yxform.which.value="news";   
  document.yxform.keywords.value="资讯标题或者内容";   
  document.yxform.keywords.style.color="#999999";   
  line5.style.display="none";   
  line4.style.display="none";   
  line2.style.display="";   
  line1.style.display="";   
  line3.style.display="";   
  line0.style.display="";   
  line6.style.display="";   
  yx1.background="";   
  yx3.background="";   
  yx4.background="";   
  yx2.background="";   
  yx6.background="";   
  yx7.background="";   
 }   
 if (n==yx6) {   
  document.yxform.which.value="vipinfo";   
  document.yxform.keywords.value="商机名称";   
  document.yxform.keywords.style.color="#999999";   
  line6.style.display="none";   
  line5.style.display="none";   
  line2.style.display="";   
  line1.style.display="";   
  line0.style.display="";   
  line4.style.display="";   
  line3.style.display="";   
  yx1.background="";   
  yx3.background="";   
  yx4.background="";   
  yx5.background="";   
  yx2.background="";   
  yx7.background=""; 
  
 }   
  
}   
</SCRIPT>这是个搜索栏的菜单,当点击商机机会时我想自动跳到index.asp,但不行呀
response.redirect "index.asp";这句话错了,怎么改呀 
}   
</SCRIPT>

解决方案 »

  1.   

    <%response.redirect "index.asp"%>
      

  2.   

    怎么会没错,即使是服务器端的JS,也要在script标签里加上runat=server,而且问题不是这个,而是你这个不应该用ASP的response.redirect,而是应该用JS的window.location="index.asp"才对。
      

  3.   

    javascript里没有response啊。
    可以用location.href="index.jsp"
      

  4.   

    1.response.redirect改为:location.href ="index.asp" 
    2.yx1 yx2....是已赋值的变量?
      

  5.   

    这是点击产品库的js<A onclick=javascript:yx_bg(yx3); href="javascript:;"><FONT color=#ffffff>产品库</FONT></A>
    我改成
    <SCRIPT language=javascript >    
    function yx_bg(n) {    
     n.background="/skins/skin1/images/i_topselected.gif";     
     if (n==yx2) {    
      document.yxform.which.value="all";    
      document.yxform.keywords.value="输入商业机会";    
      document.yxform.keywords.style.color="#999999";    
      line2.style.display="none";    
      line1.style.display="none";    
      line0.style.display="";    
      line3.style.display="";    
      line4.style.display="";    
      line5.style.display="";    
      line6.style.display="";    
      yx1.background="";    
      yx3.background="";    
      yx4.background="";    
      yx5.background="";    
      yx6.background="";    
      yx7.background="";  
      response.redirect "index.asp"; }    
     if (n==yx1) {    
      document.yxform.which.value="all";    
      document.yxform.keywords.value="商机名称";    
      document.yxform.keywords.style.color="#999999";    
      line2.style.display="";    
      line3.style.display="";    
      line4.style.display="";    
      line5.style.display="";    
      line6.style.display="";    
      line1.style.display="none";    
      line0.style.display="none";    
      yx2.background="";    
      yx3.background="";    
      yx4.background="";    
      yx5.background="";    
      yx6.background="";    
      yx7.background="";    
     }    
     if (n==yx3) {    
      document.yxform.which.value="productshow";    
      document.yxform.keywords.value="输入产品名称";    
      document.yxform.keywords.style.color="#999999"; 
      location.href ="index.asp";   
      line3.style.display="none";    
      line2.style.display="none";    
      line0.style.display="";    
      line1.style.display="";    
      line4.style.display="";    
      line5.style.display="";    
      line6.style.display="";    
      yx1.background="";    
      yx2.background="";    
      yx4.background="";    
      yx5.background="";    
      yx6.background="";    
      yx7.background="";    
     }    
     if (n==yx4) {    
      document.yxform.which.value="corporation";    
      document.yxform.keywords.value="输入公司名称";    
      document.yxform.keywords.style.color="#999999";    
      line4.style.display="none";    
      line3.style.display="none";    
      line2.style.display="";    
      line0.style.display="";    
      line1.style.display="";    
      line5.style.display="";    
      line6.style.display="";    
      yx1.background="";    
      yx3.background="";    
      yx2.background="";    
      yx5.background="";    
      yx6.background="";    
      yx7.background="";    
     }    
     if (n==yx5) {    
      document.yxform.which.value="news";    
      document.yxform.keywords.value="资讯标题或者内容";    
      document.yxform.keywords.style.color="#999999";    
      line5.style.display="none";    
      line4.style.display="none";    
      line2.style.display="";    
      line1.style.display="";    
      line3.style.display="";    
      line0.style.display="";    
      line6.style.display="";    
      yx1.background="";    
      yx3.background="";    
      yx4.background="";    
      yx2.background="";    
      yx6.background="";    
      yx7.background="";    
     }    
     if (n==yx6) {    
      document.yxform.which.value="vipinfo";    
      document.yxform.keywords.value="商机名称";    
      document.yxform.keywords.style.color="#999999";    
      line6.style.display="none";    
      line5.style.display="none";    
      line2.style.display="";    
      line1.style.display="";    
      line0.style.display="";    
      line4.style.display="";    
      line3.style.display="";    
      yx1.background="";    
      yx3.background="";    
      yx4.background="";    
      yx5.background="";    
      yx2.background="";    
      yx7.background="";  
       
     }    
       
    }    
    </SCRIPT > 改了也没反应呀,哪错了呀