Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Asp implements a simple ajax message board example code

2025-03-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Index.asp

Customer messa

Previous page. "

Const C_PREVPAGE2 = "previous page"

Const C_NEXTPAGE1 = "last page"

Const C_LASTPAGE2 = "last page"

Const C_CURRENTPAGE = "Page number: {0} / {1} Page"

Const C_PAGESIZE = "{0} articles per page"

Const C_GOTOPAGE = "Jump: 1 Then

Parms=Array (Pageurl,1)

LFirstpage = Format (ClearFIRSTPAGE1mparms)

Parms=Array (Pageurl,CInt (CurrentPage)-1)

LPrevpage = Format (Cure PREVPAGE1mparms)

Else

LFirstpage=C_FIRSTPAGE2

LPrevpage=C_PREVPAGE2

End If

If CInt (CurrentPage)

AccHelper.asp

Ajax.js

The code is as follows:

Var http_request = false

Function makeRequest (obj,url) {

Http_request = false

If (window.XMLHttpRequest) {/ / Mozilla, Safari,...

Http_request = new XMLHttpRequest ()

If (http_request.overrideMimeType) {

Http_request.overrideMimeType ('text/xml')

}

} else if (window.ActiveXObject) {/ / IE

Try {

Http_request = new ActiveXObject ("Msxml2.XMLHTTP")

} catch (e) {

Try {

Http_request = new ActiveXObject ("Microsoft.XMLHTTP")

} catch (e) {}

}

}

If (! http_request) {

Alert ('Giving up: (Cannot create an XMLHTTP instance')

Return false

}

Http_request.onreadystatechange = function ()

{

If (http_request.readyState = = 4) {

If (http_request.status = = 200) {

UpdateObj (obj,http_request.responseText)

}

Else

{

UpdateObj (obj, "")

}

}

}

Http_request.open ('GET', url, true)

Http_request.send (null)

}

Function updateObj (obj,data) {

OBJ [XSS _ clean] = data

}

Function $(url) {

Var obj = document.getElementById ("content")

Obj.style.display='block'

Document.getElementById ("container") .style.margin = "10px auto 0px"

OBJ [XSS _ clean] = "Loading..."

MakeRequest (obj,url)

}

Html call method:

The code is as follows:

Product contact blog

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report