| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 754 人关注过本帖
标题:[求助] xmlhttp 服务器端网页的代码写在哪里?
只看楼主 加入收藏
shiguoyu_555
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2006-3-14
收藏
 问题点数:0 回复次数:1 
[求助] xmlhttp 服务器端网页的代码写在哪里?

我想用xmlhttp实现页面无刷新更新数据,客户端提交按钮代码如下。但不知服务器端代码应写在哪个部分,比如说在page_load 等等。急用,请大虾赐教,不胜感激!!!!
<script id="clientEventHandlersJS" language="javascript">
<!--

function Button1_onclick() {
var xmlh = new ActiveXObject("Microsoft.XMLHTTP");
xmlh.open("post","chat_server.aspx",false);
xmlh.send(document.all.Textarea2.innertext);
Textarea1.innertext=xmlh.responsetext;
}

//-->
</script>

搜索更多相关主题的帖子: 服务器 网页 xmlhttp 代码 
2006-03-18 22:32
linuxpluto
Rank: 4
等 级:贵宾
威 望:13
帖 子:889
专家分:23
注 册:2005-8-14
收藏
得分:0 

asp代码
<%
Response.Charset="gb2312"
username=Request.QueryString("username")
if username="127" then
Response.write username
Response.Write "正确"
else
Response.write username
Response.Write "错误"
end if
Response.Write "<br>怎么样显示汉字"
Response.End()
%>
html代码
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="javascript">
var rtnStr=""
var httpRequest=null
function sendRequest(sndStr) {
if(window.XMLHttpRequest)
{ //Mozilla 浏览器
httpRequest = new XMLHttpRequest();
}else if (window.ActiveXObject)
{
var msxmls = new Array('Msxml2.XMLHTTP.5.0','Msxml2.XMLHTTP.4.0','Msxml2.XMLHTTP.3.0','Msxml2.XMLHTTP','Microsoft.XMLHTTP');
for (var i = 0; i < msxmls.length; i++)
{
try
{
httpRequest = new ActiveXObject(msxmls[i]);
}catch (e) {
}
}
}
if (httpRequest != null)
{
httpRequest.onreadystatechange=processRequest
httpRequest.open("GET", sndStr, true);
httpRequest.send(null);
}else{alert("你的浏览器不支持XMLHttpRequest对象")}

}


processRequest=function () {
if (httpRequest.readyState == 4)
{ // 判断对象状态
if (httpRequest.status == 200)
{ // 信息已经成功返回,开始处理信息
rtnStr=httpRequest.responseText;
} else { //页面不正常
alert("您所请求的页面有异常。");
}
}else {
//alert("loading...")
}
}
var i=0
function userCheck() {

sendRequest("ajax.asp?username="+document.getElementById("username").value)
document.getElementById("box").innerText=rtnStr
}
</script>
</head>
<div id="box"></div>
<body>
<form name="form1" action="" method="post">
用户名:<input type="text" name="username" value="">&nbsp;
<input type="button" name="check" value="唯一性检查" onClick="userCheck()">
<input type="submit" name="submit" value="提交">
</form>
</body>
</html>


吃的比猪还差,干的比驴还累,起的比鸡还早,睡得比小姐还晚,挣得比民工还少,看起来比谁都好——苦命的人.人生短短几十年,不要给自己留下了什么遗憾,想笑就笑,想哭就哭,该爱的时候就去爱,无谓压抑自己
2006-03-26 21:53
快速回复:[求助] xmlhttp 服务器端网页的代码写在哪里?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.033628 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved