toggle

How to getElementByClass instead of GetElementById with JavaScript?

橙三吉。 提交于 2019-11-25 23:18:21
问题 I\'m trying to toggle the visibility of certain DIV elements on a website depending on the class of each DIV. I\'m using a basic JavaScript snippet to toggle them. The problem is that the script only uses getElementById , as getElementByClass is not supported in JavaScript. And unfortunately I do have to use class and not id to name the DIVs because the DIV names are dynamically generated by my XSLT stylesheet using certain category names. I know that certain browsers now support