সম্পাদনা
<!DOCTYPE html> <html> <body> <button onclick="execute()">ক্লিক করুন</button> <ul> <li>পিএইচপি</li> <li>জাভা</li> <li>পাইথন</li> <li>জাভাস্ক্রিপ্ট</li> </ul> <script> function execute() { document.querySelectorAll("li:nth-child(odd)").forEach(function(element) { element.style.backgroundColor = "tomato"; }); document.querySelectorAll("li:nth-child(even)").forEach(function(element) { element.style.backgroundColor = "orange"; }); } </script> </body> </html>
পূর্বরূপ