Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <head> <style> body { background: #f3f3f3 url('img_tree.png') no-repeat fixed right top; } </style> </head> <body> <h1>Hello World!</h1> <p><b>Tip:</b> Try to to resize the window if the scrollbar is not available.</p> <p>Click the button to toggle between scroll and fixed position.</p> <p><b>Tip:</b> Scroll the page before and after you have clicked the button.</p> <button id="toggle" onclick="myFunction();">Set bg image to scroll</button> <p>Some text to enable scrolling.. <br><br><br><br> Some text to enable scrolling.. <br><br><br><br> Some text to enable scrolling.. <br><br><br><br> Some text to enable scrolling.. <br><br><br><br> Some text to enable scrolling.. <br><br><br><br> Some text to enable scrolling.. <br><br><br><br> Some text to enable scrolling.. <br><br><br><br> Some text to enable scrolling.. <br><br><br><br> Some text to enable scrolling.. <br><br><br><br> Some text to enable scrolling.. <br><br><br><br> Some text to enable scrolling.. <br><br><br><br> </p> <script> function myFunction() { 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> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_style_backgroundattachment2 by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:24:47 GMT --> </html>
Result:
Try it Yourself - © w3schools.com