Body backgroundProperty
Body Object
Definition and Usage
The background property sets or returns the value of the background attribute of the body element.
The background property describes the background image of the document.
Syntax
bodyObject.background=URL
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the background property.
Example
Example
Return the value of the background attribute of the body element:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
</head>
<body id="logo" background="logo.png">
<script>
document.write("The background image is: ")
document.write(document.getElementById("logo").background);
</script>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
</head>
<body id="logo" background="logo.png">
<script>
document.write("The background image is: ")
document.write(document.getElementById("logo").background);
</script>
</body>
</html>
Try it yourself »
Body Object Other Extensions