background

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

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

Plural: backgrounds

attachment

UK[əˈtætʃmənt] US[əˈtætʃmənt]

n. (sent by email) attachment, attachment thing; attachment, attachment; seizure of property<Law> arrest, seizure (person, property)

Plural: attachments

javascript backgroundAttachmentProperty syntax

Function:Set whether the background image is fixed or scrolls with the rest of the page.

Syntax: Object.style.backgroundAttachment=scroll|fixed

Comments: Please set an available background color, so if Background images are not available and the page gets a good visual effect.

javascript backgroundAttachmentProperty example

<html>
<head>
<style type="text/css">
body
{
background-color="#FFCC80";
background-image:url(http://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg);
}
p
{
color:white;
}
</style>
<script type="text/javascript">
function changeAttachment()
{
document.body.style.backgroundAttachment="fixed";
}
</script>

</head>
<body>

<input type="button" onclick="changeAttachment()"
value="Set background-image to be fixed" />
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>

</body>
</html>

Run instance »

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