CSS Portal
Run
Search
« Back to
HTML onscroll Event Attribute
<!DOCTYPE html> <html> <head> <title>onscroll event</title> <style> div { width: 200px; height: 150px; border: 1px solid; overflow: scroll; } </style> </head> <body> <p>To demonstrate the onscroll event attribute, scroll the scroll bar of the following item:</p> <div id="scrl" onscroll="scrl()">The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. </div> <script> function scrl () { document.getElementById("scrl").style.backgroundColor="orange"; } </script> </body> </html>
If this site has been useful, we’d love your support! Running this site takes time and resources, and every small contribution helps us keep creating valuable content. Consider buying us a coffee to keep things going strong!
☕ Buy a Coffee