How to change HTML background with JavaScript Function? I need some simple function to change background from one image to another?
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- How to get the background from multiple images by
- void before promise syntax
Try something like this:
Very simple like this:
Hope this helps you
UPDATE
Or if you wanna use CSS (more elegant solution) with it, you could use:
An alternative IFF using jquery
demo codes:
reference links:
All of these answers change the body. The most direct way to change the html background is like so: