JavaScript to implement picture loop fade playback method _javascript Skills

Source: Internet
Author: User

This article describes the JavaScript implementation of the image loop fade playback method. Share to everyone for your reference. The implementation methods are as follows:

Copy Code code as follows:
<title> graphics loop Fade playback effect code </title>
<!--1, insert the following code between HEML <script language=javascript>
<!--//
SANDRA0 = new Image ();
SANDRA0.SRC = "/images/m01.jpg";
SANDRA1 = new Image ();
SANDRA1.SRC = "/images/m02.jpg";
Sandra2 = new Image ();
SANDRA2.SRC = "/images/m03.jpg";
var i_strngth=1
var i_image=0
var imageurl = new Array ()
Imageurl[0] = "/images/m01.jpg"
IMAGEURL[1] = "/images/m02.jpg"
IMAGEURL[2] = "/images/m03.jpg"
function ShowImage () {
if (document.all) {
if (I_strngth <=110) {
Testimage.innerhtml= " ';
I_strngth=i_strngth+10
var timer=settimeout ("ShowImage ()", 100)
}
else {
Cleartimeout (timer)
var timer=settimeout ("Hideimage ()", 1000)
}
}
if (document.layers) {
Cleartimeout (timer)
Document.testimage.document.write ("Document.close ()
i_image++
if (i_image >= imageurl.length) {i_image=0}
var timer=settimeout ("ShowImage ()", 2000)
}
}
function Hideimage () {
if (I_strngth >=-10) {
Testimage.innerhtml= " ';
I_strngth=i_strngth-10
var timer=settimeout ("Hideimage ()", 100)
}
else {
Cleartimeout (timer)
i_image++
if (i_image >= imageurl.length) {i_image=0}
I_strngth=1
var timer=settimeout ("ShowImage ()", 500)
}
}
-->
</script>
<body>
<!--2, modify <body> statement for:-->

<body onload= "ShowImage ()" >

<!--3, add the following code to HEML <body></body>: top:120px;left:240px can set the location of the display-->

<div id= "Testimage" style= "position:absolute;visibility:visible;top:120px;left:240px" ></div>
</body>

I hope this article will help you with your JavaScript programming.

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.