Code tạo màu nền ngẫu nhiên cho tiện ích Label trong Blogspot

Thủ thuật sau giúp cho từng bài viết trên blog bạn có màu nền ngẫu nhiên và thay đổi mỗi hi refresh Demo Thực hiện Thêm đoạn js sau vào trước thẻ..
Code tạo màu nền ngẫu nhiên cho tiện ích Label trong Blogspot
Hướng dẫn tạo màu nền ngẫu nhiên cho tiện ích Label trong Blogspot Demo - Đăng nhập trang quản trị Blogger , chọn Template > Edit Template - Copy đoạn code phía dưới, dán vào trước thẻ </body> : Code chỉ dùng Javascript <script type='text/javascript'> //<[![CDATA[ function get_random_color() { var letters = '0123456789ABCDEF'.split(''); var color = '#'; for (var i = 0; i < 6; i++) { color += letters[Math.round(Math.random() * 14)]; } return color; } (function(){ "use strict"; const labelcolor = document.querySelectorAll(".label-size"); for(var j = 0; j < labelcolor.length;j++){ labelcolor[j].setAttribute("style","background-color:" + get_random_color()); }})(this) //]]> </script> Code sử dụng thư viện Jquery <script src='https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js' type='text-e30/javascript'></script> <scri…