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 - JavaScript Tutorial
From the course: Computer Science Principles Lab: JavaScript
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Capture input from the user9m 17s
-
(Locked)
Manage different variable types6m 43s
-
(Locked)
Create conditional tests12m 16s
-
(Locked)
Build compound conditional tests8m 42s
-
(Locked)
Use while loops4m 13s
-
(Locked)
Use for loops7m 35s
-
Create arrays to store groups of values3m 36s
-
(Locked)
Use loops with arrays3m 26s
-
(Locked)
Changing arrays3m
-
(Locked)
-