মূল বিষয়বস্তু
কম্পিউটার প্রোগ্রামিং
কোর্স: কম্পিউটার প্রোগ্রামিং > অধ্যায় 6
পাঠ 5: DOM ইভেন্ট- ইভেন্ট (event) ব্যবহার করার মাধ্যমে ওয়েবপেজ ইন্টার্যাক্টিভ করা
- ইভেন্ট লিসেনার (event listener) যোগ করা
- চ্যালেঞ্জ: বিড়াল ক্লীক করা
- DOM (ডম) ইভেন্টের (event) প্রকারভেদ
- ইভেন্টের বৈশিষ্ট্যসমূহ ব্যবহার করা
- চ্যালেঞ্জ: বিড়ালের মোছ
- ইভেন্ট দিয়ে ফর্ম প্রসেস করা
- চ্যালেঞ্জ: ম্যাড লিব্স
- ইভেন্টের ডিফল্ট আচরণ রোধ করা
- সারাংশ: DOM ইভেন্ট
© 2023 Khan Academyব্যবহারের শর্তাদিগোপনীয়তার নীতিমালাকুকি নোটিশ
DOM (ডম) ইভেন্টের (event) প্রকারভেদ
ব্রাউজার অনেকগুলো ইভেন্টের সূচনা করে। ইভেন্টগুলোর একটি তালিকা MDN (মজিলা ডেভেলপার নেটওয়ার্ক) এ রয়েছে এবং এইখানে কয়েকটি সাধারণ ইভেন্টের ধরণ ও নাম দেওয়া হল:
- মাউসের ইভেন্ট (
MouseEvent
): mousedown, mouseup, click, dblclick, mousemove, mouseover, mousewheel, mouseout, contextmenu - টাচ ইভেন্ট (
TouchEvent
): touchstart, touchmove, touchend, touchcancel - কি-বোর্ডের ইভেন্ট (
KeyboardEvent
): keydown, keypress, keyup - ফর্মের ইভেন্ট: focus, blur, change, submit
- উইন্ডোর ইভেন্ট: scroll, resize, hashchange, load, unload
You might be wondering when to use touch events versus mouse events, since they're so similar.
Touch events are only triggered on touch-enabled devices like smartphones and touch-screen laptops. Mouse events like
click
and mousemove
are triggered on the majority of browsers and devices. However, in most smartphones, the mouseover
event isn't triggered at all, because they can't detect a finger hovering over the phone. Some smartphones are adding sensors for that though, so more smartphones will detect mouseover
in the future. In most cases, you'll want to listen to mouse events instead of touch events, because those are the most universal.
আলোচনায় অংশ নিতে চাও?
কোন আলাপচারিতা নেই।