Tryit Editor v1.8

Source Code:
<!DOCTYPE html> <html> <head> <style> body { background:#f3f3f3 url('img_tree.png') no-repeat fixed right top; } </style> <script> function bgAttachment() { var x=document.body.style.backgroundAttachment; document.getElementById("toggle").innerHTML=(x=="scroll")? "Set bg image to scroll!":"Set bg image to fixed!"; document.body.style.backgroundAttachment=(x=="scroll")? "fixed":"scroll"; } </script> </head> <body> <button id="toggle" onclick="bgAttachment();">Set bg image to scroll</button> <p>Scroll the page and watch the background image.</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> <p>This is a paragraph</p> </body> </html>
Result:
W3Schools.com - Try it yourself