記憶盒子

把記憶裝進(jìn)灰色的盒子,封裝起來(lái),那年那月,重新拾起。

首頁(yè)搜索目錄
search
當(dāng)前主題: 軟件編程

xmlhttp實(shí)現(xiàn)無(wú)刷新獲取數(shù)據(jù)

作者:Kaka    時(shí)間:2009-9-12 23:36:45    瀏覽:    評(píng)論:0

xmlhttp實(shí)現(xiàn)無(wú)刷新獲取數(shù)據(jù)的例子:

 --------- test1.htm -----------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script language="vbscript">
function change(a)
  dim xmlhttp
  set xmlhttp = CreateObject("Microsoft.XMLHTTP")
  xmlhttp.open "POST","test1.asp?a=" & a, false
  xmlhttp.send
  document.all.text2.value = xmlhttp.responseText 
  set xmlhttp = nothing
end function
</script>
</HEAD>
<BODY>
<input name="text1" onchange="vbscript:change(document.all.text1.value)">
<input name="text2">
</BODY>
</HTML>

 --------- test1.asp -----------------------

<%
a = replace(trim(request("a")), "'", "")
dim conn,rs
set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.mappath("test.mdb") & ";Persist Security Info=False"
' 假設(shè)字段名為 a, b
set rs = conn.execute("select b from table1 where a='" & a & "'")
if not rs.eof then
  response.write rs("b")
else
  response.write ""
end if
set rs = nothing
set conn = nothing
%>

 

原創(chuàng)文章轉(zhuǎn)載請(qǐng)注明:文章轉(zhuǎn)載自 記憶盒子 [http://www.howtostagehomes.com/blog/]
本文地址:
http://www.howtostagehomes.com/blog/archives/xml-getting-data-with-no-refresh.html

 

x

標(biāo)簽: xml  

※ 網(wǎng)站速度慢?試試網(wǎng)站自動(dòng)優(yōu)化工具 ※

  • 擴(kuò)展閱讀
上一篇: 創(chuàng)建獨(dú)立的Firefox profile
下一篇: 客戶端excel表如何導(dǎo)入遠(yuǎn)程sql server服務(wù)器(asp)

發(fā)表評(píng)論:

◎歡迎參與討論,請(qǐng)?jiān)谶@里發(fā)表您的看法、交流您的觀點(diǎn)。

訂閱博客                   QQ交流群(312716741)

  • 通過(guò)Google訂閱本站 通過(guò)鮮果訂閱本站 通過(guò)抓蝦訂閱本站
  • 通過(guò)QQ郵箱訂閱本站 通過(guò)Yahoo訂閱本站 通過(guò)有道訂閱本站

Search

最新評(píng)論及回復(fù)

最近留言

網(wǎng)站分類

Powered By Z-Blog 1.8 Walle Build 91204 Designed by Han'space

Copyright @2009-2024 All Rights Reserved. 粵ICP備14028160號(hào)-1

Powered By Z-Blog 1.8 Walle Build 91204
Copyright @2009-2024 All Rights Reserved.