Fri, 17 May 2024


How to change the background of the page with JavaScript?

By: Nathalie, NetArt Media
Tue, 9 February 2021

Imagine a situation where you wish to change in runtime the background color of the current document (not only at the beginning by specifying the bgcolor property of the <BODY> tag). This is quite simple with JavaScript, you just need to call :
(for example to get a red background)

document.bgColor="FF0000";


Category: Javascript
Share this post:



See All Scripts






Subscribe for our newsletter

Receive the latest blog posts direct in your mailbox