এলিমেন্টের স্ক্রোলবার স্ক্রোল হলে onscroll ইভেন্ট ঘটে। নিচের কোড রান করে জাভাস্ক্রিপ্টে onscroll ইভেন্ট কীভাবে ইমপ্লিমেন্ট করা হয় তা শিখুন:
উদাহরণ
<!DOCTYPE html> <html> <head> <style> div { border: 2px solid blue; width: 300px; height: 100px; overflow: scroll; } </style> </head> <body> <div id="content"> This is demo text. This is demo text.This is demo text.This is demo text. This is demo text.This is demo text.This is demo text.This is demo text. This is demo text.This is demo text.This is demo text. This is demo text.This is demo text.This is demo text. This is demo text.This is demo text.This is demo text. This is demo text.This is demo text.This is demo text. </div> <p id = "myScroll"> </p> <script> document.getElementById("content").onscroll = function() {myFunction()}; function myFunction() { document.getElementById("myScroll").innerHTML = "Scroll successfull!."; } </script> </body> </html>