Javascript Tetikleyici Olaylar (Events)
Javascriptte Kullanılan Eventlar:
Giriş Olayları
onblur - When a user leaves an input field
onchange - When a user changes the content of an input field
onchange - When a user selects a dropdown value
onfocus - When an input field gets focus
onselect - When input text is selected
onsubmit - When a user clicks the submit button
onreset - When a user clicks the reset button
onkeydown - When a user is pressing/holding down a key
onkeypress - When a user is pressing/holding down a key
onkeyup - When the user releases a key
onkeyup - When the user releases a key
onkeydown vs onkeyup - Both
Fare Olayları
Olay | İşlevi | Örnek |
onmouseover/onmouseout | Farenin elemanın üzerine gelmesi veya üzerinden gitmesi | <div class="alan1" onmouseover="alert('üstümden git')" onmouseout="alert('Yine gel')"></div> |
onmousedown/onmouseup | Farenin elemanın üzerinde tuşlarına basılması veya bırakılması |
onmousedown - When mouse is clicked: Alert which element
onmousedown - When mouse is clicked: Alert which button
onmousemove/onmouseout - When moving the mouse pointer over/out of an image
onmouseover/onmouseout - When moving the mouse over/out of an image
Klikleme Olayları
Olay | İşlevi | Örnek |
onclick | Farenin elemanın üzerinde tıklaması | <h1 onclick="this.style.color='#FF0000'">Merhabalar</h1> |
ondblclick | Farenin elemanın üzerinde çift tıklaması |
Load Events
onload - When the page has been loaded
onload - When an image has been loaded
onerror - When an error occurs when loading an image
onunload - When the browser closes the document
onresize - When the browser window is resized
Others
What is the keycode of the key pressed?
What are the coordinates of the cursor?
What are the coordinates of the cursor, relative to the screen?
Was the shift key pressed?
Which event type occurred?
Kaynak: