前台页面:
<!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="Content-Type" c />
<title>无标题文档</title>
</head>
<script language="javascript">
var http_request = false;
function onloads() {
http_request = false;
url = "showAllCustomer.php";
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Giving up

Cannot create an XMLHTTP instance');
return false;
}
http_request.onreadystatechange = fristCustomer;
http_request.open('GET', url, true);
http_request.send(null);
}
function fristCustomer() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
text = http_request.responseText;
document.all("ztl").innerHTML = "程序初始化成功";
document.all("context").innerHTML = text;
} else {
document.all("ztl").innerHTML = "程序初始化失败,请确定浏览器支持Javascript。";
}
}
}
</script>
<style type="text/css">
body { text-align:center; position:relative; }
.t1 { width:750px; border-bottom:#FDB801 solid 2px; height:27px; position:relative;}
.t1 .d1 { background-image:url(images/itemBJ.gif); width:138px; float:left; height:27px; vertical-align:middle; font-family:"宋体"; font-size:14px; font-weight:bold; color:#FFFFFF; line-height:27px;}
.t1 .d2 { font-family:"宋体"; font-size:12px; color:#FF0000; width:500px; float:left; height:27px; line-height:27px; vertical-align:middle;}
.t2 { width:748px; border:#FDB801 solid 1px; border-top:0px; background-color:#FFF8DA;}
.t2 .d1 {width:730px; margin:10px; margin-bottom:5px; margin-top:5px;}
.t2 .d1 .divs { float:left; font-family:"宋体"; font-size:12px; font-weight:bold; color:#5C5639;}
</style>
<body>
<div class="t1">
<div class="d1" >用户管理平台</div>
<div class="d2" id="ztl"></div>
</div>
<div class="t2">
<div class="d1">
<div class="divs" style="width:30px;">ID</div>
<div class="divs" style="width:60px;">用户名</div>
<div class="divs" style="width:90px;">电话号码</div>
<div class="divs" style="width:70px;">邮编</div>
<div class="divs" style="width:140px;">邮件地址</div>
<div class="divs" style="width:230px;">家庭地址</div>
<div class="divs" style="width:30px;">VIP</div>
<div class="divs" style="width:30px;"></div>
<div class="divs" style="width:30px;"></div>
</div>
<div id="context" class="d1">
</div>
</div>
</body>
</html>
后台页面:
<?php
header('Content-Type:text/html;charset=gb2312');
echo "实验";
?>
第一次读取能显示出中文,当再次读取后就成乱码了.不知道为什么啊,看了看网上的帖子,说是字符编码问题,我已经都改了,但没有效果.高手看看,谢谢