JavaScript to implement scrolling picture News instance Code _javascript tips

Source: Internet
Author: User

The following code is used to implement picture news

Copy Code code as follows:

var index = 0;
var Timer = null;

function Initgallery () {
for (var i=0; i< 4; i++) {
document.getElementById ("Fpic" +i). Style.display = "None";
document.getElementById ("Ftitl" +i). Style.display = "None";
document.getElementById ("Fnum" +i). Style.classname = "Numoff";
}
Startchange ();
SetTimer ();
}

function Startchange () {
index = index% 4;

Changepic (index);
CHANGETITL (index);
Changenum (index);

index++;
}

function Changepic (index) {
for (var i=0; i<4;i++) {
document.getElementById ("Fpic" +i). Style.display = "None";
}
document.getElementById ("Fpic" +index). Style.display = "block";
}

function Changetitl (index) {
for (var i=0; i<4; i++) {
document.getElementById ("Ftitl" +i). Style.display = "None";
}
document.getElementById ("Ftitl" +index). Style.display = "block";
}

function Changenum (index) {
for (var i=0; i<4; i++) {
document.getElementById ("Fnum" +i). ClassName = "Numoff";
}
document.getElementById ("Fnum" +index). ClassName = "Numoff Numon";
}

function Cleartimer () {
This.clearinterval (Timer);
}

function SetTimer () {
Timer = Window.setinterval (Startchange, 3000)
}

function Setindex (index) {
This.index = index;
This.startchange ();
}

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.