« 也许人生该这样js 无限级分类 »

ajax asp

<script language="javascript" type="text/javascript">
var xmlHttp = false;
/* Create a new XMLHttpRequest object to talk to the Web server */
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp = false;
  }
}
@end @*/
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}
function a()
{
  // Get the city and state from the web form
  // Build the URL to connect to
  var url = "tj.asp?id=1";
  // Open a connection to the server
  xmlHttp.open("GET", url, true);

  // Setup a function for the server to run when it's done
  xmlHttp.onreadystatechange = update;
  xmlHttp.send(null);
}

function update()
{
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
    document.getElementById('count').innerHTML=response;
  }
}
</script>
<body onLoad="a();">
<input type="button" onClick="a()" />
<span id="count">载入中...</span>
</body>

tj.asp

<%
conn.execute("update tj set count=count+1 where id="&int(request("id")))
set rs=conn.execute("select  count from tj where id="&int(request("id")))
sleep(500)
response.Write rs("count")
%>

 

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

网站目录

最近发表

最新评论及回复

文章归档

Search

Powered By Z-Blog 1.8 Terminator(beta) Build 71218 Designed by Michael

Copyright 0-9999 subin.org.cn Rights Reserved. 晋ICP备08000685号