在**.js文件中
var __cc_sys_url ="http://192.168.0.42:8081/count/"
//var __cc_sys_url ="http://"+window.location.host+":"+window.location.port+"/count/"
及***.asp文件中
<script language="JavaScript" 
    src="http://192.168.0.42:8081/count/**.js"> 
</script> 我想改成自动获取当前服务器IP及端口号
所以改成了如下:
在**.js文件中
var __cc_sys_url ="http://"+window.location.host+":"+window.location.port+"/count/"
及***.asp文件中
<script language="JavaScript" 
    src="http://"+window.location.host+":"+window.location.port+"/count/**.js"> 
</script>这样改不行,莫非把window.location改成document.location ,大家帮帮忙吧,谢谢了

解决方案 »

  1.   

    获取服务器IP: <%=Request.ServerVariables("LOCAL_ADDR")%>端口号:<%=Request.ServerVariables("SERVER_PORT")%>
      

  2.   


    JS文件
    <script type="text/javascript">
    var __cc_sys_url = "http://"+window.location.host + ":" + window.location.port+"/count/" ;
    </script>
    asp文件
    <%
    url = "http://" + Request.ServerVariables("HTTP_HOST") + ":" + Request.ServerVariables("SERVER_PORT") + "/count/**.js"
    %>
    <script type="text/javascript" src="<%=url%>"></script>
      

  3.   

    呵呵,综合phoeni_xin与Free_Wind22的方法,
    ***.asp文件中 
    改为
    <%
    url = "http://" + Request.ServerVariables("LOCAL_ADDR") + ":" + Request.ServerVariables("SERVER_PORT") + "/count/**.js"
    %>
    <script type="text/javascript" src="<%=url%>"></script>
    后,分别测试了一下,***.asp文件代码没有问题了,但是
    在**.js文件中改成 
    <scripttype="text/javascript">var __cc_sys_url="http://"+window.location.host+":"+ window.location.port+"/count/" ; </script> 
    这个还是不对,请大家多费费心,呵呵,谢谢大家了
      

  4.   

    JS文件中不要<script type=...这些只要var __cc_sys_url = "http://"+window.location.host + ":" + window.location.port+"/count/" ;alert出来是什么?
      

  5.   

    alert出两个端口号,把window.location.port去掉就好了,呵呵,问题终于解决了,呵呵,谢谢你了
      

  6.   


    3Q~~~  感谢!!
    var __cc_sys_url = "http://"+window.location.host
    就可以了.