Home  >  Article  >  Web Front-end  >  Examples of common functions for multiple layer switching effects implemented in javascript_javascript skills

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

WBOY
WBOYOriginal
2016-05-16 15:51:221019browse

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;
}

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.

Statement:
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