+ 1
event keyword in JavaScript
1_all event types inherits from Event object. 2_Some event types inherits from UI event object Are the two phrases above correct? and what is the event keyword?
8 Respostas
+ 2
مهران رئیسی
That's interesting. This StackOverflow discussion gives more detail.
https://stackoverflow.com/questions/1510094/is-event-a-reserved-word-in-javascript/14024400
Look at jhurshman answer
+ 1
Both statements are correct. But I am not aware of any event keyword. Are you talking about the deprecated event function?
+ 1
event keyword
https://code.sololearn.com/WYmpm526ps0J/?ref=app
i think event keyword is refer to event type object. is right?
+ 1
I corrected it
+ 1
no. event passed automatically. you should have touched the word in my code.
+ 1
That's a good discussion. Thank you
0
مهران رئیسی
I didn't find any event keyword in your code.
onclick is an HTML attribute that allows JavaScript to listen for click events on the element.
0
مهران رئیسی
Your program does not work. event.target is only available if your event handler has at least one parameter.
Look at this code I created
https://code.sololearn.com/Wwt50NG8BOs6/
I have used addEventListener to add my event listener. That enables me to pass my load function has a callback instead of calling it manually. When using addEventListener, your event listener first argument is an Event object.
This old chapter from a book published in 2009 talks about the event object.
https://www.peachpit.com/articles/article.aspx?p=1394321&seqNum=3
Note that the first parameter, event, can be named anything. Which means that the below code will work
function load (e) {
e.target.innerHTML = "...";
}