Home >Web Front-end >JS Tutorial >JavaScript interlaced color changing function code_Basic knowledge

JavaScript interlaced color changing function code_Basic knowledge

WBOY
WBOYOriginal
2016-05-16 18:17:51952browse

First define two styles about the background color
tag is the id object
c1 is style 1
c2 is style 2

Copy code The code is as follows:

<script> <br>function changeRowsBg(tag,c1,c2) ​​{ <br> var i = 0; <br> var obj_tag = document .getElementsByTagName(tag); .className = c2; <br>  } <br>} <br></script>

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