JavaScript Picture Auto Rotate Code

Source: Internet
Author: User
Tags eval

JavaScript Picture Auto Rotate Code

JavaScript Document
var Spicarr = new Array ();
var gindex = new Array ();
var sid = New Array ();
var timeout = 6000;
var Isie = (' Microsoft Internet Explorer ' = navigator.appname);
function Initslide (NAME,TIMEOUT1) {
Spicarr[name] = new Array ();
Gindex[name] = 0;
Sid[name] = null;
if (TIMEOUT1) {
Timeout = timeout1;
}
}
/*
Content = new Array (picture path, title, URL);
*/
function InitData (name, index, content) {
Spicarr[name][index] = content;

}

function Initfirst (name) {
Document.images[name + ' _pic '].src = spicarr[name][0][0];
Document.images[name + ' _pic '].alt = spicarr[name][0][1];
$ (name + ' _piclink '). href = spicarr[name][0][2];
$ (name + ' _title '). InnerHTML = spicarr[name][0][1];
$ (name + ' _title '). href = spicarr[name][0][2];
}

function $ (objname) {
if (document.getElementById) {
Return eval (' document.getElementById (' + objname + ') ');
else if (document.layers) {
Return eval ("document.layers['" + objname + "']");
}else{
Return eval (' document.all. ' + objname);
}
}
var plpic = new Image ();
function Slidepic (name,index) {
Gindex[name] = index;

if (Isie) {
Document.images[name + ' _pic '].filters.item (0). Transition = 12;
Document.images[name + ' _pic '].filters.item (0). Apply ();
}

Document.images[name + ' _pic '].src = spicarr[name][index][0];
Document.images[name + ' _pic '].alt = spicarr[name][index][1];
$ (name + ' _piclink '). href = spicarr[name][index][2];
$ (name + ' _title '). InnerHTML = spicarr[name][index][1];
$ (name + ' _title '). href = spicarr[name][index][2];

if ((index+1) <spicarr[name].length) {
PLPIC.SRC = Spicarr[name][index+1][0];//preload;
}

if (Isie) {
Document.images[name + ' _pic '].filters.item (0). Play ();
}
}

function Nextpic (name) {
Gindex[name] = ((gindex[name]+1) >=spicarr[name].length 0: (gindex[name]+1));
Slidepic (name, Gindex[name]);
}

function Prevpic (name) {
Gindex[name] = ((gindex[name]-1) <0? (spicarr[name].length-1): (gindex[name]-1));
Slidepic (name, Gindex[name]);
}

function Inislide (name) {
if (sid[name]==null) {
Sid[name] = setinterval (' nextpic (' +name+ ') ', timeout);
}
}
function Pauseslide (name) {
Clearinterval (Sid[name]);
Sid[name] = null;
}

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.