2 Pages
Unlock Document

Marist College
Computer Science
CMPT 120L-115
Matthew Johnson

A Balanced Introduction to Computer Science, 3 Edition David Reed Chapter Five: JavaScript and User Information A. User Input via Text Boxes 1. An HTML element that provides a space within the page where the user can enter information 2. The Text Box Element – type of input element (can be embedded) a. i. id associates a unique identifier with the element ii. size specifies the width in terms of the number of characters that will fit within the box iii. the value can be an empty string (double quotes with nothing inside); this would mean that the box is initially empty and the user can change the contents by typing them in iv. JavaScript can access the contents of the box by using document.getElementById(‘box id’).value; B. JavaScript Variables – names used to symbolize a dynamic value that might change over time 1. Stores a value in memory, makist it accessible via the variable’s name 2. Automatically created the 1 time they are used 3. Memory Cell – a piece of memory a browser stores the specified value in a. After a value has been assigned to a variable, any reference to the variable name evaluates to the value stored in its associated memory cell i. They can be substituted for each other 4. Variables for Reusing Values – temporarily store values that are used over and over again a. onclick=username=document.getElementById(‘name’).value; documenet.getElementById(‘outputDiv’).innerHTML= ‘hello ‘ + unserName + ‘welcome to my web page.’;”> i. ‘hello’ is a string literal 5. Variable for Temporary Values a. Variables are necessary for performing “swaps”, such as with images C. Web Pages that Compute 1. Data type – a category for information being processed a. Def
More Less

Related notes for CMPT 120L-115

Log In


Don't have an account?

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.