javascript background property


  Translation results:

UK [ˈbækgraʊnd] US [ˈbækˌɡraʊnd]

n. (Painting, etc.) background; background color; background information; soundtrack

Plural: backgrounds

javascript background propertysyntax

Function:Set all background properties.

Syntax: Object.style.background=background-color background-image, background-repeat, background-attachment, background-position

Parameters: background-color Set the background color of the element. background-image Set the background image. background-repeat Set whether and how the background image repeats. background-attachment Whether the background image is fixed or scrolls with the rest of the page. background-position sets the starting position of the background image.

javascript background propertyexample

<html>
<head>
<script type="text/javascript">
function setStyle()
{
document.body.style.background="#FFCC80 url(http://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg) repeat-y";
}
</script>
</head>
<body>

<input type="button" onclick="setStyle()"
value="Set background style" />

</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance

Popular Recommendations

Home

Videos

Q&A