AdvWeb-1/14 DePaul University SNL 262 Advanced Web Page Design Chapt 10 - Document/location/navigator Objects - Instructor: David A. Lash.

Slides:



Advertisements
Similar presentations
Chapter 7 JavaScript: Introduction to Scripting. Outline Simple Programs Objects and Variables Obtaining User Input with prompt Dialogs – –Dynamic Welcome.
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
In this lecture, you will learn: ❑ How to link between pages of your site ❑ How to link to other sites ❑ How to structure the folders on your web site.
Hypertext Markup Language. Platform: - Independent  This means it can be interpreted on any computer regardless of the hardware or operating system.
JavaScript (Part 2) CS 183 4/13/2010. JavaScript (Part 2) Will cover: ◦ For.. In ◦ Events ◦ Try.. Catch, Throw ◦ Objects.
Web Basics ISYS546. Basic Tools Web server –Default directory, default home page –Virtual directory Web page editor –Front Page Web page languages –HTML,
Javascript Document Object Model. How to use JavaScript  JavaScript can be embedded into your html pages in a couple of ways  in elements in both and.
1 DePaul University SNL 262 Web Page Design Frames! - Chapt 20 Yet Another Way to Divide Up The Screen. Instructor: David A. Lash.
CS /13 DePaul University SNL 262 Advanced Web Page Design Review & Introduction - I Instructor: David A. Lash.
AdvWeb-1/29 DePaul University SNL 262 Advanced Web Page Design Introduction To JavaScript - II Instructor: David A. Lash.
CIS101 Introduction to Computing
CM143 - Web Week 2 Basic HTML. Links and Image Tags.
JavaScript ICW: Lecture 11 Tom Chothia. Last Lecture URLs Threads, to make a process run in parallel: Make it extend Thread Give it a run method Call.
HTML & Dreamweaver 101 Aman Yadav. Definitions HTTP – The Web uses a protocol called HTTP (Hyper Text Transport Protocol) to communicate between the Web.
AdvWeb-1/12 DePaul University SNL 262 Web Page Design Chapt 10 - Putting Graphics on A Web Page Instructor: David A. Lash.
The Browser Object Model (BOM) The API of JavaScript’s browser host environment SE-2840 Dr. Mark L. Hornick 1.
Start -> All Programs -> Classes -> Web Expressions -> Dreamweaver.
Javascript and the Web Whys and Hows of Javascript.
Copyright © Texas Education Agency, All rights reserved. 1 Web Technologies Website Development with Dreamweaver.
JavaScript - Document Object Model. Bhawna Mallick 2 Unit Plan What is DOM and its use? Hierarchy of DOM objects. Reflection of these objects in an HTML.
Introduction to JavaScript Dr. John P. Abraham University of Texas – Pan American.
Web Technologies Website Development Trade & Industrial Education
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.
Unobtrusive JavaScript
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
JavaScript Part 1.
History, Navigator, Screen and Form Objects Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.
Web Design (5) Navigation (1). Creating a new website called ‘Navigation’ In Windows Explorer, open the folder “CU3A Web Design Group”; and then the sub-folder.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
1 CSC160 Chapter 9: The Document Object. Outline Document objects Properties of the document object linkColor alinkColor vlinkColor bgColor fgColor lastModified.
Objective Static vs. Dynamic Web pages. Variables. Assignments. JavaScript Hierarchy of Objects JavaScript Functions (prompt(“”,””) Document.write(“”)
Introduction to JavaScript 41 Introduction to Programming the WWW I CMSC Winter 2004 Lecture 17.
Project 9: Exploring the Document Object Essentials for Design JavaScript Level One Michael Brooks.
 2001 Deitel & Associates, Inc. All rights reserved. 1 Chapter 20 – Dynamic HTML: Object Model and Collections Outline 20.1Introduction 20.2Object Referencing.
Navigator, Windows and Frames
Document Objects Forms, Images and Links. The document object model Each element of an HTML document, such as an image, form, link, or button, can be.
Creating Links. The Anchor Element: The anchor tag can be used in three different ways: 1.External link – to link to a web page outside your own website.
Modified from Moseley ’s sli desWeb Applications Development. Lecture 3 Slide 1 Lecture 3: Dynamic Web Pages – Introduction to JavaScript Instructor: Dr.
Introduction to JavaScript Objects, Properties, Methods.
CSS1 Dynamic HTML Objects, Collections & Events. CSS2 Introduction Dynamic HTML treats HTML elements as objects. Element’s parameters can be treated as.
HTML (Hyper Text Markup Language) Lecture II. Review Writing HTML files for web pages – efficient compact – fundamental. Text files with htm extension.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
© 2007 D. J. ForemanJS-1 A Light Introduction for Non-programmers JavaScript for Beginners.
Links in HTML What you need to know….. Hyperlinks or links Millions of linked web pages make up the World Wide Web Used to connect a web page to another.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
School of Computing and Information Systems CS 371 Web Application Programming JavaScript - DOM Modifying the Page from within.
HTML CS 105. Page Structure HTML elements control the details of how a page gets displayed. Every HTML document has the following basic structure: … …
JavaScript Object Model. Biggest Advantage of JavaScript  I can access values of HTML elements using JavaScript  I can modify values of HTML elements.
Hyperlink ● Anchor tag and its attributes ● Four Types of URL ─ ─ Absolute addressing ─ Relative addressing ─ Intrapage ● Attributes -- link, vlink,
Chapter 6 Murach's JavaScript and jQuery, C6© 2012, Mike Murach & Associates, Inc.Slide 1.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
Web Programming Java Script-Introduction. What is Javascript? JavaScript is a scripting language using for the Web. JavaScript is a programming language.
COM621: Advanced Interactive Web Development Lecture 6 – JavaScript (cont.)
Copyright © Terry Felke-Morris Web Development & Design Foundations with HTML5 8 th Edition CHAPTER 14 KEY CONCEPTS 1 Copyright.
1 The Document Object Model. 2 Objectives You will be able to: Describe the structure of the W3C Document Object Model, or DOM. Use JavaScript to access.
Applied Component I Unit II Introduction of java-script
CS 371 Web Application Programming
JavaScript is a programming language designed for Web pages.
Web Development & Design Foundations with HTML5 7th Edition
JavaScript for Beginners
14 A Brief Look at JavaScript and jQuery.
Introduction to JavaScript
Introduction to JavaScript
JavaScript Basics What is JavaScript?
JavaScript is a scripting language designed for Web pages by Netscape.
IDT Links in HTML What you need to know….
JavaScript for Beginners
JavaScript for Beginners
Presentation transcript:

AdvWeb-1/14 DePaul University SNL 262 Advanced Web Page Design Chapt 10 - Document/location/navigator Objects - Instructor: David A. Lash

AdvWeb-2/14 Chapt 10 - Document Object u The document object represents a web document or page. – It is a child of the window object – technically you can refer to window.document to refer to the current document. u But just document is shorter. – If you had frames there might exist > 1 document opbjects each with its own name.

AdvWeb-3/14 Chapt 10 - Window Hierarchy

AdvWeb-4/14 More Document Objects Properties u Here are more properties: – cookie - a special property enabling trusted web servers to read & write cookies. – Links[] - an array of link objects representing the links in the document. – vlinkColor - the color of the visited links in the document. – alinkColor - the color of a link while activated in the document.. – fgColor - the default text color of the document. – bgcolor - background color of the document

AdvWeb-5/14 Web Documents u The document object represents the web document & has the following properties: – referrer - the URL of the document that contained the link that the user clicked on to get to the current document. – title - the text between the & tags. – URL - a string representing the URL from where the document was loaded. – images[] - an array of images objects the represent elements from the document – forms[] - an array of objects representing the form elements in the document. – lastmodified - a string set to the last modified date of the document – anchors[] - array of objects populated by the anchors of the document.

AdvWeb-6/14 Documents Properties Example Cool backgrounds function colorit() { document.bgColor=colors[x]; if (x++ >= 2) x=0; timerID=setTimeout("colorit()",2000); } Setting and Cancelling Timer var x = 0; var colors= new Array("#CCFFFF", "#ff0000", "#00ff00"); document.bgColor="#ffff00"; document.write( "referrer=" + document.referrer + " " ); document.write( "title=" + document.title + " " ); document.write( "URL=" + document.URL + " " ); document.write( "brcolor=" + document.bgColor + " " ); timerID=setTimeout("colorit()",2000); See: examples/11_list10-4.html

AdvWeb-7/14 A word about refferrer Referrer can be used by sites to save where the browser was before your site. For example, can write this property when user hits submit on a form. Could track where folks are coming from.

AdvWeb-8/14 LastModified Property – Displaying the last modified date Test Document This page was last modified on: document.write(document.lastModified); See: examples/11_list10-1.html

AdvWeb-9/14 Images Array – images[] - an array of images objects the represent elements from the document u the most usful property is the src property. u document.two.src=“sample.gif”; u Where two was set in tag earlier as: – - See example on next slide

AdvWeb-10/14 Images Object example Timed Images function change_image() { temp=document.two.src; document.two.src=document.one.src; document.one.src=temp; timerID=setTimeout("change_image()",2000); } Setting and Cancelling Timer Keep your eye on the ball. <SCRIPT LANGUAGE="JavaScript" timerID=setTimeout("change_image()",2000); examples/11_list10-2.html

AdvWeb-11/14 Location Object u An object that represents URL of the document displayed in the window – location.href - the conplete text of the URL being displayed – location.pathname - complete pathname – location.protocol - http, ftp, file, etc. – Can use location on left hand side of equation to set a new location URL for document u location=“ u location=“file1.html”

AdvWeb-12/14 Location Object Example Timed Images function leaving() { location=" } Setting and Cancelling Timer You are currently at= document.write( location + " " ); document.write( "host=" + location.host + " " ); document.write( "pathname=" + location.pathname + " " ); document.write( "protocol=" + location.protocol + " " ); document.write( "Going to my new home page in 5 seconds" + " " ); timerID=setTimeout("leaving()",5000); examples/11_list10-3c.html

AdvWeb-13/14 Navigator Object u Here are more properties: – appName - a simple name of the browser – platform - hardware plaform running on – language - the language supported (e.g., en- english or fr - french). – appVersion - the version # of the borwser.

AdvWeb-14/14 Navigator Object Navigator Object var x = 0; var colors= new Array("#CCFFFF", "#ff0000", "#00ff00"); document.bgColor="#ffff00"; document.write( "browser=" + navigator.appName + " " ); document.write( "version=" + navigator.appVersion + " " ); document.write( "platform=" + navigator.platform + " " ); document.write( "language=" + navigator.language + " " ); – examples/11_list10-5.html