HTML DOM Body background properties
Definition and Usage
background property sets or returns the value of the body element background attributes.
background attribute describes the background image of the document.
grammar
bodyObject.background=URL
Browser Support
All major browsers support background attributes.
Examples
Examples
Returns the background attribute of the body element:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
</head>
<body id="logo" background="logo.png">
<script>
document.write("背景图片是: ")
document.write(document.getElementById("logo").background);
</script>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
</head>
<body id="logo" background="logo.png">
<script>
document.write("背景图片是: ")
document.write(document.getElementById("logo").background);
</script>
</body>
</html>
try it"
Body Object