新手AJAX遇到中文翻译成乱码希望各位大侠给予帮助

steven8116392 2008-07-16 09:16:57
index.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<!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" content="text/html; charset=gb2312" />
<title>鞍山逸天行科技有限公司</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-bottom: 0px;
color: #FFFFFF;
text-decoration: none;
}
#Layer1 {
position:absolute;
left:158px;
top:233px;
width:700px;
height:69px;
z-index:1;
}
-->
</style>

<link href="css/1.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
a:link {
color: #FFFFFF;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #FF0000;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
color: #00FFFF;
}
#Layer2 {
position:absolute;
left:521px;
top:462px;
width:86px;
height:24px;
z-index:2;
}
#Layer3 {
position:absolute;
left:162px;
top:462px;
width:66px;
height:26px;
z-index:3;
}
#Layer4 {
position:absolute;
left:769px;
top:464px;
width:104px;
height:25px;
z-index:4;
}
-->
</style></head>
<script language="javascript" type="text/javascript">
function GE(a){return document.getElementById(a);}
function check(){
if(GE('user_id').value==''){alert('用户名不能为空');}
var X=new ActiveXObject("Msxml2.XMLHTTP");
if(X){
X.onreadystatechange=function(){
if(X.readyState==4){
if(X.status==200){
eval(X.responseText)
}
else{GE('text1').innerHTML=X.statusText}
}
else{GE('text1').innerHTML="正在提交数据..."}
};
X.open('POST','landingback.asp',true);
X.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
var SendData = 'user_id='+GE('user_id').value+'&password='+GE('password').value
X.send(SendData)
}
else{
GE('text1').innerHTML='你的浏览器不支持XMLHttpRequest'
}
}

</script>
<body>
<div id="Layer1">
<% if session("yeah")="yeah" then
user_name=session("staff_name")
depart=session("staff_department")
session("ok")="ok"
session("staff_name")=session("staff_name")
session("staff_department")=session("staff_department")
session("on")="ggjl"
aa="images/1-22.gif"
bb="visibility:hidden"
cc="denglu.asp"
else
aa="images/1-1.gif"
cc="landingback.asp"

end if


%>
<form action="" method="post" name="form1" class="un1" id="form1">
<table width="564" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="275" height="30">用户名:<%=user_name%>
<input name="user_id" id="user_id" type="text" class="un2" style="<%=bb%>" onchange="check()"/><span id="text1"></span></td>
<td width="162" rowspan="2" align="center" valign="middle">
<input type="image" src="<%=aa%>" width="77" height="34" /></td>
<td width="163" rowspan="2" align="center" valign="middle"> </td>
</tr>
<tr>
<td height="50">密  码:<%=depart%>
<input id="password" name="password" type="password" class="un2" style="<%=bb%>"/></td>
</tr>
</table>
</form>
</div>
<div class="un3" id="Layer2">发言人</div>
<div class="un3" id="Layer3">主 题</div>
<div class="un3" id="Layer4">时 间</div>
<table width="1004" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><table width="1004" height="218" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="right" valign="top" background="images/wz_01.jpg">
<script language=javascript>
var flashURL="~topflash.swf";
var flashWIDTH="990";
var flashHEIGHT="143";
</script>
<script src="flash.js" language="javascript"></script>
</td>
</tr>
</table>
<table width="1004" border="0" cellspacing="0" cellpadding="0">
<tr>
<td rowspan="2"><img src="images/wz_02.jpg" width="125" height="114" alt="" /></td>
<td width="762" height="91" background="images/wz_03.jpg"> </td>
<td rowspan="2"><img src="images/wz_04.jpg" width="117" height="114" alt="" /></td>
</tr>
<tr>
<td><img src="images/wz_05.jpg" width="762" height="23" alt="" /></td>
</tr>
</table>
<table width="1004" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/wz_06.jpg" width="1004" height="57" alt="" /></td>
</tr>
</table>
<table width="1004" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="125" height="435" background="images/wz_07.jpg"> </td>
<td width="762" height="435" align="left" valign="top" background="images/wz_08.jpg">
<table width="762" border="0" cellpadding="0" cellspacing="0" class="un1" align="left">
<tr>
<td height="58" align="right" background="images/wz_08-1.jpg">共<%=rs.pagecount%>页,当前<%=page%>页数:</td>
</tr>
<tr>
<td height="400" align="center" valign="top"><table width="700" border="0" cellpadding="0" cellspacing="0" class="un1">
<tr>
<td height="40" align="left" valign="top">
</td>
<td></td>
</tr>

</table></td>
</table></td>
<td width="117" align="left" background="images/wz_09.jpg"> </td>
</tr>
</table>
<table width="1004" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/wz_10.jpg" width="1004" height="27" alt="" /></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>

后台页
<%@ LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="conn.asp"-->
<%
user_id=request("user_id")
pwd=request("password")
if user_id="" or pwd="" then
str="好好好好好好"
else
sql="select * from staff where staff_id='"&user_id&"'"
set rs=Server.Createobject("ADODB.RecordSet")
rs.Open sql,conn,1,3
if rs.eof or rs.bof then
str="坏好好好好"

else
if rs("staff_pwd")<>pwd then

str="喜欢好好好好好"

else
session("staff_name")=rs("staff_name")
session("staff_department")=rs("staff_department")
session("yeah")="yeah"
rs("landing_time")=now()
rs("landing_times")=rs("landing_times")+1
rs.update

rs.close
set rs=nothing

end if
end if
end if
Response.Write "GE('text1').innerHTML='"+escape(str)+"';"
Response.End

%>
看看哪有毛病?帮忙改下!小菜鸟在这里谢谢了
...全文
48 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
steven8116392 2008-07-17
  • 打赏
  • 举报
回复
我用的是ASP不知道该怎么+中文编码呢?
nightsky1 2008-07-16
  • 打赏
  • 举报
回复
页面够乱的。 加了中文编码了吗?
如JSP中 <%@ page contentType="text/html;charset=GBK"%>

52,799

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧