What kind of ajaxJS.js is used by pjblog to comment?
In this issue, the editor will bring you about the ajaxJS.js used by pjblog for commentation. the article is rich in content and analyzes and describes it from a professional point of view. I hope you can get something after reading this article.
[xss_clean] ('data is being read, please wait.
')
Function showloading ()
{
Var obj=document.getElementById ("loadingg")
If (obj.style.displaylists = "")
{
Obj.style.left= ((document.documentElement.clientWidth-parseFloat (obj.style.width)) / 2) + document.documentElement.scrollLeft+ "px"
Obj.style.top= ((document.documentElement.clientHeight-parseFloat (obj.style.height)) / 2) + document.documentElement.scrollTop+ "px"
Obj.style.display= ""
} else {obj.style.display= "none";}
}
Function $(id)
{
Return document.getElementById (id)
}
Function echo (obj,html)
{
$(obj) [xss_clean] = html
}
Function fopen (obj)
{
$(obj) .style.display = ""
}
Function fclose (obj)
{
$(obj) .style.display = "none"
}
Function createxmlhttp ()
{
Var xmlhttp=false
Try {
Xmlhttp = new ActiveXObject ("Msxml2.XMLHTTP")
}
Catch (e) {
Try {
Xmlhttp = new ActiveXObject ("Microsoft.XMLHTTP")
}
Catch (e) {
Xmlhttp = false
}
}
If (! xmlhttp & & typeof xMLHttpRequestrated undefined) {
Xmlhttp = new XMLHttpRequest ()
If (xmlhttp.overrideMimeType) {/ / set the MiME category
Xmlhttp.overrideMimeType ('text/xml')
}
}
Return xmlhttp
}
Function getdata (url,obj1,obj2)
{
Var xmlhttp=createxmlhttp ()
If (! xmlhttp)
{
Alert ("your browser does not support XMLHTTP clients!")
Return
}
Showloading ()
Xmlhttp.onreadystatechange=requestdata
Xmlhttp.open ("GET", url,true)
Xmlhttp.send (null)
Function requestdata ()
{
Fopen (obj1)
/ / echo (obj1, "loading data, please wait a moment.")
/ / alert (xmlhttp.readyState)
If (xmlhttp.readyState==4)
{
If (xmlhttp.status==200)
{
If (obj1 updated obj2) {fclose (obj1);}
Echo (obj2,xmlhttp.responseText)
Showloading ()
}
}
}
}
Function postdata (url,obj,data)
{var rnd=Math.random ()
Var xmlhttp=createxmlhttp ()
If (! xmlhttp)
{
Alert ("your browser does not support XMLHTTP clients!")
Return
}
Showloading ()
Xmlhttp.open ("POST", url, true)
Xmlhttp.onreadystatechange=requestdata
Xmlhttp.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded")
Xmlhttp.send (data)
Function requestdata ()
{
Fopen (obj)
Echo (obj, "data is being submitted, please wait a moment.")
If (xmlhttp.readyState==4)
{
If (xmlhttp.status==200)
{
Echo (obj,xmlhttp.responseText)
Reget (rnd)
SetTimeout ("echo ('showresult','')", 2000)
Echo ('Message','')
Showloading ()
}
}
}
}
Function lTrim (str)
{
If (str.charAt (0) = = "")
{
/ / if the first character on the left of the string is a space
Str = str.slice (1); / / remove spaces from the string
/ / this sentence can also be changed to str = str.substring (1, str.length)
Str = lTrim (str); / / Recursive call
}
Return str
}
/ / remove the space to the right of the string
Function rTrim (str)
{
Var iLength
ILength = str.length
If (str.charAt (iLength-1) = "")
{
/ / if the first character to the right of the string is a space
Str = str.slice (0, iLength-1); / / remove spaces from the string
/ / this sentence can also be changed to str = str.substring (0, iLength-1)
Str = rTrim (str); / / Recursive call
}
Return str
}
/ / remove the spaces on both sides of the string
Function trim (str)
{
Return lTrim (rTrim (str))
}
Function f (obj)
{
Return trim (eval ("document.ajax_post." + obj+ ".value"))
/ / return trim ($(obj) .value)
}
Function SaveReply ()
{
If (f ("username") = "")
{
Alert ("Please fill in the user name")
Return false
}
If (f ("Message") = "")
{
Alert ("content cannot be empty")
Return false
}
Var validate,password,log_DisKey=0,log_DisURL=0,log_DisSM=0
Validate= ""
Password= ""
If (document.ajax_post.log_DisKey.checked) {
Log_DisKey=f ("log_DisKey")
}
If (document.ajax_post.log_DisURL.checked) {
Log_DisURL=f ("log_DisURL")
}
If (document.ajax_post.log_DisSM.checked) {
Log_DisSM=f ("log_DisSM")
}
If ((typeof eval (document.ajax_post.validate))! = "undefined") {
If (f ("validate") = "")
{
Alert ("Please fill in the verification code")
Return false
} else {
Validate=f ("validate")
}
}
If ((typeof eval (document.ajax_post.password))! = "undefined") {
Password=f ("password")
}
Data= "username=" + escape (f (username)) + & password= + escape (password) + & validate= + escape (validate) + & log_DisSM= + escape (log_DisSM) + & log_DisURL= + escape (log_DisURL) + & log_DisKey= + escape (log_DisKey) + & Message= + escape (f (Message)) + & logID= + escape (f ("logID")) + & action= + escape (f (action)
/ / alert (data)
Postdata ("wbc_blogcomm.asp", "showresult", data)
Return true
}
The above is what kind of ajaxJS.js is used for the pjblog comments shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.