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.

Slides:



Advertisements
Similar presentations
Introducing JavaScript
Advertisements

Computer and Communication Fundamental Basic web programming Lecture 8 Rina Zviel-Girshin.
JavaScript and the DOM Les Carr COMP3001 Les Carr COMP3001.
JavaScript Part 6. Calling JavaScript functions on an event JavaScript doesn’t have a main function like other programming languages but we can imitate.
HTML 5 and CSS 3, Illustrated Complete Unit L: Programming Web Pages with JavaScript.
Lesson 12- Unit L Programming Web Pages with JavaScript.
The Web Warrior Guide to Web Design Technologies
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Computer Science 103 Chapter 4 Advanced JavaScript.
JavaScript 101 Lesson 5: Introduction to Events. Lesson Topics Event driven programming Events and event handlers The onClick event handler for hyperlinks.
Web Development & Design Foundations with XHTML Chapter 14 Key Concepts.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
Web Programming Material From Greenlaw/Hepp, In-line/On-line: Fundamentals of the Internet and the World Wide Web 1 Introduction The JavaScript Programming.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
Event Handlers CS101 Introduction to Computing. Learning Goals Learn about event handlers Determine how events are useful in JavaScript Discover where.
Bridges To Computing General Information: This document was created for use in the "Bridges to Computing" project of Brooklyn College. You are invited.
Generations of Programming Languages First generation  Machine Language Second Generation  Assembly Language Third Generation  Procedural language such.
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
JavaScript Part 1.
Lesson 19. JavaScript errors Since JavaScript is an interpreted language, syntax errors will usually cause the script to fail. Both browsers will provide.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
CSS Class 7 Add JavaScript to your page Add event handlers Validate a form Open a new window Hide and show elements Swap images Debug JavaScript.
1 JavaScript in Context. Server-Side Programming.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
CO1552 Web Application Development HTML Forms, Events and an introduction to JavaScript.
Client-Side Scripting JavaScript.  produced by Netscape for use within HTML Web pages.  built into all the major modern browsers. properties  lightweight,
JavaScript Errors What Could Possibly Go Wrong WCPGW- A statement of unbridled optimism and also an immediate trigger for Murphy's Law. Generally uttered.
JavaScript, jQuery, and Mashups Incorporating JavaScript, jQuery, and other Mashups into existing pages.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
1 JavaScript 2 JavaScript. 2 Rollovers Most web page developers first use JavaScript for rollovers A rollover is a change in the appearance of an element.
Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 8 Scott Marino.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
05 – Java Script (1) Informatics Department Parahyangan Catholic University.
JavaScript, Fourth Edition
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
1 JavaScript in Context. Server-Side Programming.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
Javascript Overview. What is Javascript? May be one of the most popular programming languages ever Runs in the browser, not on the server All modern browsers.
Understanding JavaScript and Coding Essentials Lesson 8.
Document Object Model Nasrullah. DOM When a page is loaded,browser creates a Document Object Model of the Page.
Tutorial 11 1 JavaScript Operators and Expressions.
LESSON : EVENTS AND FORM VALIDATION -JAVASCRIPT. EVENTS CLICK.
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
Client-side (JavaScript) Validation. Associating a function with a click event – Part 1 Use the input tag’s onclick attribute to associate a function.
SE-2840 Dr. Mark L. Hornick 1 Dynamic HTML Handling events from DOM objects.
Build in Objects In JavaScript, almost "everything" is an object.
Programming Web Pages with JavaScript
Week 3: Introduction to Javascript
Unit M Programming Web Pages with
Web Development & Design Foundations with HTML5
JavaScript is a programming language designed for Web pages.
JavaScript.
Unit M Programming Web Pages with
14 A Brief Look at JavaScript and jQuery.
DHTML Javascript Internet Technology.
DHTML Javascript Internet Technology.
Training & Development
JavaScript Basics What is JavaScript?
JavaScript is a scripting language designed for Web pages by Netscape.
Web Programming and Design
Web Programming and Design
Presentation transcript:

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 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.

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

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

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

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

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+ “!”); }

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(); }

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.