Home > Web Front-end > JS Tutorial > body text

Examples of common functions for multiple layer switching effects implemented in javascript_javascript skills

WBOY
Release: 2016-05-16 15:51:22
Original
1032 people have browsed it

The example in this article describes the common function of multiple layer switching effects implemented in javascript. Share it with everyone for your reference. The specific implementation method is as follows:

function ChangeDiv(tagId,tagName,divId,divName,zDivCount,tagclass,divclass) {
for(i=0;i<=zDivCount;i++) {
document.getElementById(divName+i).style.display="none";
document.getElementById(divName+i).className='';
document.getElementById(tagName+i).className='';
}
document.getElementById(divName+divId).style.display="block";
document.getElementById(tagName+tagId).className=tagclass;
document.getElementById(divName+divId).className=divclass;
}

Copy after login

tagId, tagName is the id and name of the control layer clicked by the mouse divId, divName is the id and name of the layer controlled to be displayed and hidden zDivCount is the number of displayed and hidden layers - 1 (if it is 5 layer is 4)

tagclass and divclass are the style of the control layer and the style of the controlled layer respectively

I hope this article will be helpful to everyone’s JavaScript programming design.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template