Presentation is loading. Please wait.

Presentation is loading. Please wait.

JAVASCRIPT A quick review. True False ■The DOM is a standardized way of referring to parts of a Web page. ■TRUE ■In the DOM, attributes have their own.

Similar presentations


Presentation on theme: "JAVASCRIPT A quick review. True False ■The DOM is a standardized way of referring to parts of a Web page. ■TRUE ■In the DOM, attributes have their own."— Presentation transcript:

1 JAVASCRIPT A quick review

2 True False ■The DOM is a standardized way of referring to parts of a Web page. ■TRUE ■In the DOM, attributes have their own properties. ■TRUE ■Any script using DOM aspects will use only one object, property, or method, but not a combination. ■FALSE ■In DOM, multiple objects, properties, and methods, all referring to a single item, can be placed in a single string using the dot notation. ■TRUE ■Scripts always include only a single statement. ■FALSE – A single instruction is called a statement, but scripts can contain many statements.

3 True False ■The getElementById method works for all elements in the document, even if they do not have an id attribute associated with them. ■FALSE ■The script associated with the onMouseOut event handler is executed in response to the mouse pointer moving off an element. ■TRUE ■The onClick event handler can only be associated with links. ■FALSE ■The assignment operator is two subsequent equal signs ==. ■FALSE just one = ■In an if statement, the condition being tested is placed in parentheses following the word 'if‘ ■TRUE

4 A Few More Questions ■In order to have scripting code run as soon as a Web page is loaded, you use the _____ event handler. ■Onload ■A group of code given a name is called a ________. ■Function ■The && characters represent _______ ■AND ■The || characters represent ________ ■OR ■The ! character represents ________ ■NOT

5 Valid Code? ■Is the following code written in proper syntax for a JavaScript function? Answer Yes or No, and if not, explain why. Function greeting() { Document.getElementById("greeting").innerHTML=("Greetings Earthlings! Take me to your leader.”) }  Not valid – Missing semi-colon

6 Debug the following JavaScript function writeMsg() { document.getElementById("message").innterHTML=("Thanks for contacting us."); } function writeMsg() { document.getElementById("message").innerHTML=("Thanks for contacting us."); }

7 What is wrong with this script? function writeAlert(person) { alert(Your message has been sent. Thanks for contacting us, +person+ !); } function writeAlert(person) { alert(“Your message has been sent. Thanks for contacting us, “+person+ “!”); }

8 What is wrong with this script? function checkFields() { var name==document.getElementById('firstnameinput').value; if (name=null name="") { alert(First name must be filled out); } writeAlert(name); document.forms('contact').reset(); } function checkFields() { var name=document.getElementById(‘firstnameinput').value; if (name==null || name=="") { alert("First name must be filled out"); return false; } writeAlert(name); document.forms('contact').reset(); }

9 What are the major causes of problems in this lesson? Misspelling. Syntax – { } () Quotes ; Using the wrong names for variables, ids, or functions. Not linking to your script files correctly.

10

11


Download ppt "JAVASCRIPT A quick review. True False ■The DOM is a standardized way of referring to parts of a Web page. ■TRUE ■In the DOM, attributes have their own."

Similar presentations


Ads by Google