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

How to realize MPBrowser simple Picture browser

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

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!

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