A fundamental part of scripting in JavaScript is “events”. Events are described as “reactions” the script has to actions happening within the HTML. Events encompass a world of attributes, however, the breadth of my knowledge on the subject to this point lies squarely within the “onclick” attribute and the “date” function (displays date, time, and time zone of the system) within buttons. The “onclick” attribute is used in tandem with “button” elements, which are clicked, submitted, and then return some sort of result. If submitting a form and returning results sounds familiar, that’s because we talked about it last week with the DOM. Understandably the DOM is used with events. Here is an example:

before the top button is pressed
after button is pressed, the DOM calls the information and the onclick displays it.

As you can see within the example there are many ways to achieve the same effect with the DOM either inside the button, using strictly a known function and having result display within the button or using the DOM inside of the function in the script. It seems that the DOM with be an integral part of the scripting I will do going forward. Learning the different ways to use buttons with the “onclick” attribute to get the date to display when the button is clicked was very interesting and engaging, I look forward to seeing how I can integrate these principles within my code at a later date.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s