Js獲取asp頁面返回的值(加載值)實現(xiàn)代碼
更新時間:2012年12月20日 15:47:38 作者:
本文詳細介紹Js獲取asp頁面返回的值(加載值)實現(xiàn)方法,需要了解的朋友可以參考下
復(fù)制代碼 代碼如下:
<!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="點擊加載" onclick="call_server();" />
<input type="text" style=" width:265px; height:68px;" id="aja_cnts" />
</body>
</html>
獲取頁面Response.asp代碼:document.getElementById('aja_cnts').value
Response.asp代碼示例:
復(fù)制代碼 代碼如下:
<%
Response.Write "您好!歡迎光臨悠9小店!"
Response.Write "我們的網(wǎng)址是:http://you9luck.taobao.com"
%>
相關(guān)文章
Asp 操作Access數(shù)據(jù)庫時出現(xiàn)死鎖.ldb的解決方法
在一天某個時間段內(nèi)打不開,等待好幾分鐘就會說asp腳本超時,但FTP可以登陸進去,查看數(shù)據(jù)庫目錄時,發(fā)現(xiàn)與數(shù)據(jù)庫(我的數(shù)據(jù)庫是access數(shù)據(jù)庫)同名的記錄鎖定信息文件 (.ldb文件)一直都在那里2009-04-04
ASP中字符與數(shù)字內(nèi)置操作函數(shù)整理
在ASP中,預(yù)定義了許多函數(shù),可以幫助我們簡化代碼、提高開發(fā)效率,本文將介紹一些常用的ASP字符與數(shù)字內(nèi)置操作函數(shù),以便開發(fā)人員更加方便、快速地創(chuàng)建 Web 應(yīng)用程序,2023-12-12
Ajax+ASP和Flash+ASP數(shù)據(jù)讀取取方法有些相似的實現(xiàn)方法
Ajax+ASP和Flash+ASP數(shù)據(jù)讀取取方法有些相似的實現(xiàn)方法...2007-02-02

