Assignment 4: Exploring Variable and Input (getElementById)
Description
Variables store information. There are several way a variable can be assigned its value. Variables can get their information from elements on a webpage. document.getElementById(...) provides a way to retrieving ( and later manipulating ) elements on a way. This is an essential part of web programming, the ability to interact with elements on a web page programmatically.
Task
Complete ExploringVariable&InputII. Attach with +Add Files.
Questions
1) What element allows the user to enter information on a web page? <input>
2) Explain the HTML and JavaScript requirements for accessing an element via document.getElementByID.<-- this D is suppose to be lower case :P and in <input> in order to access the data typed you put an id into the input area and then you type document.getElemebtById("insert input id").value.
Exit Homework
HTML
Create an input text that asks the user to enter a search item.
Create a button that calls googleSearch() when the user clicks on it.
JavaScript
Create a variable to store the searchtext the user entered in the input text above.
Create a function googleSearch() that,
retrieves the information from the appropriate input text below and stores the value in the variable created above.
changes the window.location.href to "https://www.google.com/search?q=" follow by variable of the searchtext