- 論壇徽章:
- 0
|
客戶端我用的是WinXP+IE6,服務(wù)端是FreeBSD4.7+Apache1.3,Apache服務(wù)器配置了在一個(gè)名為www的文件夾下可以運(yùn)行PHP與CGI程序。
客戶端頁(yè)面 index.html
<html>
<head>
<title>PHOTOSHOW 1.0</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/style.css" rel="stylesheet" type="text/css">
<script language="javascript" src="js/text.js"></script>
<script language="javascript">
var xmlHttp;//XMLHTTP對(duì)象變量
function createXMLHttpRequest()
{
if (window.ActiveXObject){
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else{
xmlHttp=new XMLHttpRequest();
}
}
function startRequest()
{
createXMLHttpRequest();
xmlHttp.onreadystatechange=handleStateChange;
xmlHttp.open("GET","test.cgi",true);
xmlHttp.send(null);
}
function handleStateChange()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status ==200)
{
window.alert(xmlHttp.responseText);
}
}
}
</script>
</head>
<body>
<div id="main">
<div id="top"><font class="text_01">PHOTOSHOW 1.0</font></div>
<div class="image_01"><img src="images/icon_01.jpg" border="0"></div>
<div class="albumlist"></div>
<div class="createalbum">
<table width="597" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="37"><img src="images/album.gif" border="0"></td>
<td width="300"><a href="#" class="text_02">創(chuàng)建一個(gè)相冊(cè)</a> <input name="album_name" type="text" class="background_01" value="相冊(cè)名稱" OnFocus="javascript:clear_text(this)"></td>
<td width="260"><input type="submit" value="創(chuàng)建" OnClick="startRequest()"> (上傳照片前首先要擁有一個(gè)相冊(cè))</td>
</tr>
</table>
</div>
</div>
</body>
</html>
服務(wù)器端頁(yè)面test.cgi
#!/usr/bin/perl
print "Content-Type:text/html;cahrset=gb2312\n\n";
print "HELLO!";
兩個(gè)文件在同一個(gè)文件夾下,可能是CGI程序的問(wèn)題,我換了請(qǐng)求靜態(tài)頁(yè)面和PHP程序頁(yè)面都能順利返回,而請(qǐng)求CGI頁(yè)面客戶端瀏覽器就死機(jī)了,也沒(méi)有傳回來(lái)任何信息,只能強(qiáng)行關(guān)閉。
希望各位高手大俠幫忙分析一下問(wèn)題出在哪里,小弟感激不盡! |
|