Get the App
SLTechnology News&Howtos  ›  Development  › 

Asp implements a simple ajax message board example code

Shulou Source: shulou.com Published: 2022-06-03 19:41:34 11月13日 Update

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

Tags: Information summary command character code content previous home page update product author keyword blog field customer news method condition format Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno vpn Linux Shulou Information MySQL