Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize MPBrowser simple Picture browser

Shulou Source: shulou.com Published: 2022-06-03 08:50:19 09月13日 Update

This article mainly introduces "how to achieve MPBrowser simple picture browser". In daily operation, I believe many people have doubts about how to achieve MPBrowser simple picture browser. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "how to achieve MPBrowser simple picture browser". Next, please follow the editor to study!

The code is as follows:

Var thisImgNo = 290

Function ajaxConn () {

Var xmlhttp = false

Try {xmlhttp = new ActiveXObject ("Msxml2.XMLHTTP");}

Catch (e) {try {xmlhttp = new ActiveXObject ("Microsoft.XMLHTTP");}

Catch (e) {try {xmlhttp = new XMLHttpRequest ();}

Catch (e) {alert (e); xmlhttp = false;}}

If (! xmlhttp) return null

This.connect = function (Url,Method,postContent) {

If (! xmlhttp) return false

Method = Method.toUpperCase ()

Try {

If (Method = = "GET") {

Xmlhttp.open (Method,Url +'?'+ postContent,true)

Xmlhttp.setRequestHeader ("Content-Type", "text/html;charset=GB2312")

SVars = null

} else {

Xmlhttp.open (Method,Url,true)

Xmlhttp.setRequestHeader ("Method", "POST" + Url+ "HTTP/1.1")

Xmlhttp.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded")

}

Xmlhttp.onreadystatechange = function () {

If (xmlhttp.readyState = = 4) {

If (xmlhttp.status = = 200) {

ImgInfo = xmlhttp.ResponseText

Var imgInfoArr = imgInfo.split ("|")

Var tmpimg = new Image ()

Tmpimg.src = imgInfoArr [0]

ThisImgNo = imgInfoArr [1]

Var element = document.getElementById ("img")

If (! element.xpos) element.xpos = 0

Element.style.width = (element.clientWidth + 130) + "px"

SlideElement ("img", element.xpos-130,0,10)

Element [XSS _ clean] + ='

'

}

}

}

Xmlhttp.send (postContent)

} catch (z) {return false;}

Return true

}

Return this

}

Function loadImg (type) {

Var element = document.getElementById ("img")

If (! element.xpos) element.xpos = 0

If (type== "pre") {

If (element.xpos==0) return false

SlideElement ("img", element.xpos+130,0,10)

} else {

If (element.xpos==- (element.clientWidth-260)) {

Var myConn = new ajaxConn ()

If (! myConn) return false

MyConn.connect ("Cmd.asp", "get", "d =" + thisImgNo)

} else {

SlideElement ("img", element.xpos-130,0,10)

}

}

}

Function slideElement (elementId,x,y,inc) {

Var element = document.getElementById (elementId)

If (element.sliding) clearTimeout (element.sliding)

If (! element.xpos) element.xpos = 0

If (! element.ypos) element.ypos = 0

If (element.xpos = = x & & element.ypos = = y) return true

If (element.xpos > x) {

Var dist = Math.ceil ((element.xpos-x) / inc)

Element.xpos = element.xpos-dist

}

If (element.xpos

< x) { var dist = Math.ceil((x-element.xpos)/inc); element.xpos = element.xpos + dist; } if(element.ypos >

Y) {

Var dist = Math.ceil ((element.ypos-y) / inc)

Element.ypos = element.ypos-dist

}

If (element.ypos < y) {

Var dist = Math.ceil ((y-element.ypos) / inc)

Element.ypos = element.ypos + dist

}

Element.style.left = element.xpos+'px'

Element.style.top = element.ypos+'px'

Element.sliding = setTimeout ('slideElement ("' + elementId+'",'+ x-ray), 10)

}

At this point, the study on "how to implement MPBrowser simple picture browser" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Pictures browsers easy browsing learning more help practical next code articles methods theories knowledge articles websites materials follow questions easy to use Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MariaDB macOS vpn Huawei