我用delphi 自带的indy httpserver做了个web的服务,类似IIS的。
在做菜单时用到一个.js文件。在本地网页显示都正常,如果通过web访问就找不到js文件,菜单显示不出来。感觉就是服务上没有js文件。但是又不知道怎么处理。。哪位大侠指点一下啊 delphiweb服务
在做菜单时用到一个.js文件。在本地网页显示都正常,如果通过web访问就找不到js文件,菜单显示不出来。感觉就是服务上没有js文件。但是又不知道怎么处理。。哪位大侠指点一下啊 delphiweb服务
<script src="../jquery-1.4.2.js" type="text/javascript"></script>
如果能,那../jquery.js 意谓著js文件放在htm位置的上一层?
检查看看对不对。
是指你的web server返回js文件时,http头部设的类型标志
<!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>
360浏览器?
那你看看web server的日志,js被访问到了吗?
能加断点单步跟踪,就更清楚了
文件放在服务器端,web脚本写的是相对路径,通过服务找到对应文件。