What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-03-02 07:55:02
style.backgroundcolor
// change background color for specific id .. function changebackground(){ document.getElementById('id').style.backgroundColor = 'green' ; } // change background color for whole body.. function changebackground(){ document.body.style.backgroundColor =... Add solution -
Other 2022-02-21 13:40:11
javascript-change color onclick()
const btn = document.querySelector('button'); function random(number) { return Math.floor(Math.random() * (number+1)); } btn.onclick = function() { const rndCol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; document.body.st... Add solution -
Javascript 2022-01-22 19:41:14
addeventlistener js to change style
var button = document.querySelector("button"); button.addEventListener("click", function() { const curColour = document.body.style.backgroundColor; document.body.style.backgroundColor = curColour === 'red' ? 'blue' : 'red'; }); Add solution -
Javascript 2021-11-21 22:31:12
give gray offlien scale to website
window.addEventListener('online', function(e) { // add your logic to update the UI when online console.log("You are online"); document.body.style.filter = 'grayscale(0)'; }, false); window.addEventListener('offline', function(e) { ... Add solution -
Javascript 2021-11-19 12:58:28
javascript style background color
// change background color for specific id .. function changebackground(){ document.getElementById('id').style.backgroundColor = 'green' ; } // change background color for whole body.. function changebackground(){ document.body.style.backgroundColor =... Add solution -
Javascript 2021-11-16 09:18:43
javascript disable scrolling
document.body.style.overflow = 'hidden'; Add solution