手机
当前位置:查字典教程网 >编程开发 >ASP教程 >Js获取asp页面返回的值(加载值)实现代码
Js获取asp页面返回的值(加载值)实现代码
摘要:复制代码代码如下:GettingServersidedatausingAJAXfunctioncreat_Object(){varxmlht...

复制代码 代码如下:

<!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=gbk" />

<title>Getting Server side data using AJAX</title>

</head>

<script>

function creat_Object() {

var xmlhttp;

if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {

try {

xmlhttp = new XMLHttpRequest();

}

catch (e) {

alert("Your browser is not supporting XMLHTTPRequest"); <BR> xmlhttp = false;

}

}

else {

xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

}

return xmlhttp;

}

var request = creat_Object();

function sever_interaction() {

if (request.readyState == 1) {

document.getElementById('aja_cnts').value = '';

document.getElementById('aja_cnts').value = 'Loading...';

}

if (request.readyState == 4) {

var answer = request.responseText;

document.getElementById('aja_cnts').value = '';

document.getElementById('aja_cnts').value = answer;

}

}

function call_server() {

request.open("GET", "Response.asp");

request.onreadystatechange = sever_interaction; request.send('');

}

</script>

<body>

<input type="button" name="btnLoad" id="btnLoad" value="点击加载" />

<input type="text" id="aja_cnts" />

</body>

</html>

获取页面Response.asp代码:document.getElementById('aja_cnts').value

Response.asp代码示例:

复制代码 代码如下:

<%

Response.Write "您好!欢迎光临悠9小店!"

Response.Write "我们的网址是:http://you9luck.taobao.com"

%>

【Js获取asp页面返回的值(加载值)实现代码】相关文章:

Asp防止留言灌水的实例代码

asp返回404错误状态码程序

asp分页的一个类

如何截取asp后台登陆密码的代码

分页代码

asp动态级联菜单代码

asp连接sqlserver数据库实现代码

记录集内随机取记录的代码

asp 防采集代码

在asp中通过getrows实现数据库记录分页的一段代码

精品推荐
分类导航