JavaScript code _ image effects for continuous scrolling images that meet web standards

Source: Internet
Author: User
Js Code that complies with web standards for continuous scrolling Images

<Script language = "javascript"> // more javascript from http://www.smallrain.net Var images = Array (); images. push (" http://www.smallrain.net /Jsimg/1.jpg"); images. push ("#"); images. push (" http://www.smallrain.net /Jsimg/2.jpg"); images. push ("#"); images. push (" http://www.smallrain.net /Jsimg/3.jpg"); images. push ("#"); images. push (" http://www.smallrain.net /Jsimg/4.jpg"); images. push ("#"); images. push (" http://www.smallrain.net /Jsimg/5.jpg"); images. push ("#"); images. push (" http://www.smallrain.net /Jsimg/6.jpg"); images. push ("#"); images. push (" http://www.smallrain.net /Jsimg/7.jpg"); images. push ("#"); images. push (" http://www.smallrain.net /Jsimg/8.jpg"); images. push ("#"); // Specify the slider's width (in pixels) var sliderwidth = 695 // Specify the slider's height var sliderheight = 82 // Specify the slider's slide speed (larger is faster 1-10) var slidespeed = 1 // configure background color: slidebgcolor = "# fff" // Specify the slider's images var leftrightslide = new Array () var finalslide = ''leftrightslide [0] = '<table border = "0" cellspacing = "1 3 "cellpadding =" 0 "width =" 695px "style =" margin-top:-10px "> '+' <tr align =" center "> '; var size = images. length/2; for (var I = 0; I <size; I ++) leftrightslide [0] + = "<td width = '80' height = '62'> <p onclick = \" window. open ('"+ images [I * 2 + 1] +"'); \ "style = \" cursor: pointer; width: 72px; height: 62px; background: url ("+ images [I * 2] +") no-repeat; \ "> </p> </td> "; leftrightslide [0] + = '</tr> </table>'; // NO NEED TO EDIT BELOW THIS LINE // var copyspeed = slidespeed leftrightslide = '<nobr>' + leftrightslide. join ("") + '</nobr> 'var iedom = document. all | document. getElementById if (iedom) document. write (''+ leftrightslide +'') var actualwidth = ''var cross_slide, ns_slide function fillup () {if (iedom) {cross_slide = document. getElementById? Document. getElementById ("test2"): document. all. test2 cross_slide2 = document. getElementById? Document. getElementById ("test3"): document. all. test3 cross_slide.innerHTML = cross_slide2.innerHTML = leftrightslide actualwidth = document. all? Cross_slide.offsetWidth: document. getElementById ("temp "). offsetWidth cross_slide2.style.left = actualwidth-5} else if (document. layers) {ns_slidemo-document.ns_slidemenu.doc ument. ns_slidemenu2 ns_slide2jwdocument.ns_slidemenu.doc ument. ns_slidemenu3 ns_slide.document.write (leftrightslide) ns_slide.document.close () actualwidth1_ns_slide.doc ument. width ns_slide2.left = actualwidth ns_slide2.document.write (leftrightslide) ns_slide2.document.close ()} lefttime = setInterval ("slideleft ()", 30)} window. onload = fillup function slideleft () {if (iedom) {if (parseInt (cross_slide.style.left)> (actualwidth * (-1) + 8) cross_slide.style.left = parseInt (partial) -copyspeed else attributes = parseInt (cross_slide2.style.left) + actualwidth-5 if (parseInt (rows)> (actualwidth * (-1) + 8) cross_slide2.style.left = parseInt (cross_slide2.style.left) -copyspeed else cross_slide2.style.left = parseInt (cross_slide.style.left) + actualwidth-5} else if (document. layers) {if (ns_slide.left> (actualwidth * (-1) + 8) rows-= copyspeed else rows = ns_slide2.left + actualwidth if (ns_slide2.left> (actualwidth * (-1) + 8) ns_slide2.left-= copyspeed else ns_slide2.left = ns_slide.left + actualwidth} if (iedom | document. layers) {with (document) {document. write ('<table border = "0" cellspacing = "0" cellpadding = "0"> <td>') if (iedom) {write ('<p style = "position: relative; width:' + sliderwidth + '; height:' + sliderheight + '; overflow: hidden"> ') write ('<p style = "position: absolute; width:' + sliderwidth + '; height:' + sliderheight + '; background-color: '+ slidebgcolor +' "onMouseover =" copyspeed = 0 "onMouseout =" copyspeed = slidespeed "> ') write (' <p id =" test2 "style =" width: 695px; position: absolute; left: 0; top: 0 "> </p> ') write (' <p id =" test3 "style =" position: absolute; left: 0; top: 0; width: 695px; "> </p> ') write (' </p> ')} else if (document. layers) {write ('<ilayer width =' + sliderwidth + 'height = '+ sliderheight + 'name = "ns_slidemenu" bgColor =' + slidebgcolor + '> ') write ('<layer name = "ns_slidemenu2" left = 0 top = 0 onMouseover = "copyspeed = 0" onMouseout = "copyspeed = slidespeed"> </layer> ') write ('<layer name = "ns_slidemenu3" left = 0 top = 0 onMouseover = "copyspeed = 0" onMouseout = "copyspeed = slidespeed"> </layer> ') write ('</ilayer>')} document. write ('</td> </table>')} script
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.