Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>object</title>
- </head>
- <body>
- <div class="wrap"></div>
- <div class="wrap"></div>
- <div class="wrap"></div>
- <div class="wrap"></div>
- <div class="wrap"></div>
- <div class="wrap"></div>
- <div class="wrap"></div>
- <div class="wrap"></div>
- <div class="wrap"></div>
- <div class="wrap"></div>
- <script>
- let box = document.querySelectorAll(".wrap");
- for (let i = 0; i < box.length; i++) {
- if (i % 2 == 0) {
- box[i].style.width = '30px';
- box[i].style.height = '30px';
- box[i].style.backgroundColor = 'red';
- } else {
- console.log('error');
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement