我用delphi 自带的indy httpserver做了个web的服务,类似IIS的。
在做菜单时用到一个.js文件。在本地网页显示都正常,如果通过web访问就找不到js文件,菜单显示不出来。感觉就是服务上没有js文件。但是又不知道怎么处理。。哪位大侠指点一下啊   delphiweb服务

解决方案 »

  1.   

    ContentType设置下application/javascript
      

  2.   

    <script src="C:\aaasss\jquery-1.4.2.js" type="text/javascript"></script>改成application/javascript   还是不对啊
      

  3.   

    我把文件放到c盘下 这样写了  还是不对
    <script src="../jquery-1.4.2.js" type="text/javascript"></script>
      

  4.   

    > 我把文件放到c盘下htm放在哪?能顺利取到htm?
    如果能,那../jquery.js 意谓著js文件放在htm位置的上一层?
    检查看看对不对。
      

  5.   


    是指你的web server返回js文件时,http头部设的类型标志
      

  6.   

    我改成  html文件 在C:\aaasss下   js文件C:\下了   但是还是不对
      

  7.   

    我的整个html  是这样的
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="REFRESH" content="5; charset=gb2312" /> 
       <title>窗体1</title>
    <style> 
     textarea 
       { border:1;
         overflow:hidden; 
         height:100%;
         width:100%;  }
     </style>
     <script src="../jquery-1.4.2.js" Type="text/javascript" ></script> <script type="text/javascript">
     $(function(){
    var name = "";
    var name1 = "";
    $("#menu ul li a").each(function() {
    $(this).click(function(){
    name = $(this).attr("title");
     name1=$(this).attr("name");
    $("#div2 div").each(function() {
    if (($(this).attr("id")!==name) && ($(this).attr("name")==name1)) {
      document.getElementById($(this).attr("id")).style.display="none"; } 
     if ($(this).attr("id")==name)
      {  
     document.getElementById($(this).attr("id")).style.display="inline"; }
    });});});}); </script>
     <script type="text/javascript">
      function clicke(Id,src){ 
      var File1 = document.getElementById("myform"); 
      var div = document.createElement("div");
      var inputTxt = document.createElement("input");
      div.style.display="none"; 
      inputTxt.type = "text";
      inputTxt.name =Id;   
      inputTxt.id =Id;   
      div.appendChild(inputTxt);
      File1.appendChild(div);
      document.getElementById("myform").submit(); } 
    </script>
     <style type="text/css">
    .div1{width:1005px;height:682px;float:left;}
    #menu ul li { display:inline; float:left; margin-bottom:10px; }
    #menu ul li a { padding:10px;text-decoration: none;}
    .main { clear:both;width:1000px; height:60px;margin-left:0px;}</style>
    </head>
    <body>
    <div class="div1">
    <form id="myform" METHOD="POST" action="../TCmdfrom.Html"  >
    <div id="Pcontrol2" style="position:relative;top:93px;left:135px">
      <div id="menu">
    <ul>
    <li ><a href="#" title=TabSheet1 name="Page1" >TabSheet1</a></li>
    </ul>
     </div>
       <div id="div2" class="main">
    <div id="TabSheet1" name="Page1" style="position:absolute;top:24px;left:4px;display:none">
    <div  style="position:absolute;left:39px;Top:65px">
    <label id="Label1"  name="Label1"  onclick=clicke("Label1","")  style="width:48px;height:13px">Label1</label>
    </div> 
    <div  style="position:absolute;left:34px;Top:123px">
    <img  id="Image1" name="Image1"  onclick=clicke("Image1",src) src="c:\aaasss\Image\Image1.gif" alt="Image"  style="width:105px;height:105px"/>
    </div> 
    <div  style="position:absolute;left:27px;Top:16px">
    <input id="Button1" type="button"  name="Button1" value="Button1" onclick=clicke("Button1","") style="width:75px;height:25px" >
    </div> 
    <div  style="position:absolute;left:158px;Top:18px">
    <input id="Edit1" type="text"  name="Edit1"  value="" style="width:121px;height:19px"/>
    </div> 
      </div>
     </div>
    </div>
    </form></div>
    </body>
    </html>
      

  8.   

    你是用什么程序访问这些html、js文件的?
      

  9.   

    360啊   delphi xe2 做的服务
      

  10.   


    360浏览器?
    那你看看web server的日志,js被访问到了吗?
    能加断点单步跟踪,就更清楚了
      

  11.   

    你在IndiHttpService的事件里加断点跟踪吧
      

  12.   

    思路是
    文件放在服务器端,web脚本写的是相对路径,通过服务找到对应文件。