From the course: Computer Science Principles Lab: JavaScript

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Capture input from the user

Capture input from the user - JavaScript Tutorial

From the course: Computer Science Principles Lab: JavaScript

Start my 1-month free trial

Capture input from the user

- [Instructor] So far all of our programs haven't had any interaction with the user. We coded the java script and ran the code. Programs need to have a way to interact with the user and that happens in multiple ways using the keyboard, mouse, or even with your voice or body. The simplest is to interact with the keyboard and mouse. We can do that using java script and html. The html defines the user interface components that the user will interact with. This includes things like text fields, check boxes and buttons. The java script then defines how the user interface elements are used and then combines them together to create a working program. Before we get into the java script let's look at the html that has already been created for us and see what is going on. There are four main items that we need to review before we jump into coding the java script. First in the opening body tag on line 9 we have an on load handler that is set up to run the java script function init. We will need…

Contents