This article mainly introduces the common functions for switching between multiple layers implemented by javascript, and involves the traversal and Operation Skills of javascript For page element styles, for more information, see the examples in this article to describe the common functions for switching between multiple layers implemented by javascript. Share it with you for your reference. The specific implementation method is as follows:
Function ChangeDiv (tagId, tagName, pId, pName, zDivCount, tagclass, pclass) {for (I = 0; I <= zDivCount; I ++) {document. getElementById (pName + I ). style. display = "none"; document. getElementById (pName + I ). className = ''; document. getElementById (tagName + I ). className = '';} document. getElementById (pName + pId ). style. display = "block"; document. getElementById (tagName + tagId ). className = tagclass; document. getElementById (pName + pId ). className = pclass ;}
TagId. tagName is the id and name pId of the control layer clicked by the mouse, pName is the id and name of the layer to be displayed and hidden under control. zDivCount is the number of layers displayed and hidden-1 (4 for five layers)
Tagclass and pclass are control layer styles and control layer styles respectively.
I hope this article will help you design javascript programs.