JavaScript: BOM and DOM CS Programming Languages for Web Applications

Slides:



Advertisements
Similar presentations
DREAMWEAVER Welcome to our website!
Advertisements

Chapter 3 – Web Design Tables & Page Layout
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
JQuery Mobile. Benefits Required links Remember that we need to add the links to the head, in this order.
Intro to HTML. HTML HTML = HyperText Markup Language Used to define the content of a webpage HTML is made up of tags and attributes Content.
HTML and CSS. HTML Hyper Text Markup Language Tells browser how to display text and images.
Programming Club IIT Kanpur. Work environment Before you begin coding,always set up your work environment to your needs IDE Notepad++ Sublime Text 2.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Presenter: James Huang Date: Sept. 26,  Introduction  Basics  Lists  Links  Forms  CSS 2.
A really fairly simple guide to: mobile browser-based application development (part 1) Chris Greenhalgh G54UBI / Chris Greenhalgh
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
JavaScript Part 6. Calling JavaScript functions on an event JavaScript doesn’t have a main function like other programming languages but we can imitate.
Web Development & Design Foundations with XHTML Chapter 7 Key Concepts.
Web Development & Design Foundations with XHTML Chapter 7 Key Concepts.
CSS BASICS. CSS Rules Components of a CSS Rule  Selector: Part of the rule that targets an element to be styled  Declaration: Two or more parts: a.
CIS 1310 – HTML & CSS 6 Layout. CIS 1310 – HTML & CSS Learning Outcomes  Describe & Apply the CSS Box Model  Configure Float with CSS  Designate Positioning.
กระบวนวิชา CSS. What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to.
Chapter 3 Tables and Page Layout
CM143 - Web Week 2 Basic HTML. Links and Image Tags.
 2008 Pearson Education, Inc. All rights reserved. 1 Introduction to HTML.
TUTORIAL 8: Enhancing a Web Site with Advanced CSS
Copyright © Texas Education Agency, All rights reserved. 1 Web Technologies Website Development with Dreamweaver.
Web Technologies Website Development Trade & Industrial Education
Chapter 2 Developing a Web Page. A web page is composed of two distinct sections: –The head content –The body Creating Head Content and Setting Page Properties.
Dr. Nuha El-KhaliliInternet Programming ( ) HTML Hyper Text Markup Language The language of web pages Maintained by the W3C
Website Development with Dreamweaver
Microsoft Expression Web-Illustrated Unit I: Working with Tables.
Dreamweaver CS4 Concepts and Techniques Chapter 9 Using Spry to Create Interactive Web Pages.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
Chapter 5 Quick Links Slide 2 Performance Objectives Understanding Framesets and Frames Creating Framesets and Frames Selecting Framesets and Frames Using.
XP Tutorial 6 New Perspectives on JavaScript, Comprehensive1 Working with Windows and Frames Enhancing a Web Site with Interactive Windows.
Layers, Image Maps, and Navigation Bars
HTML GUIDE Press F5 and then Click on the links on the left to get to the section you want Section 1: Getting Started Section 2: Moving Banner Section.
HTML CS 105. Page Structure HTML elements control the details of how a page gets displayed. Every HTML document has the following basic structure: … …
Web Site Development - Process of planning and creating a website.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
Web and Multimedia Development Copyright © Genetic Computer School 2007WM LESSON OVERVIEW  Use of Tables  Creating Tables  Try It – 1  Creating.
HTML Help book. HTML HTML is the programming language used to make web pages for the Internet. HTML stands for Hyper Text Markup Language. HTML is made.
COM621: Advanced Interactive Web Development Lecture 6 – JavaScript (cont.)
DHTML.
INTRO TO WEB DEVELOPMENT html
Applied Component I Unit II Introduction of java-script
Using DHTML to Enhance Web Pages
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Human Computer Interaction
Intro to JavaScript CS 1150 Spring 2017.
Tutorial 6 Topic: jQuery and jQuery Mobile Li Xu
Intro to CSS CS 1150 Fall 2016.
Chapter 5 - Introduction to XHTML: Part 2
Introduction to web design discussing which languages is used for website designing
Web Development & Design Foundations with HTML5
Intro to CSS CS 1150 Spring 2017.
Styles and the Box Model
Fixed Positioning.
Integrating JavaScript and HTML
Tutorial 6 Creating Dynamic Pages
CHAPTER 1 THE ABC OF PROGRAMMING
Cascading Style Sheets™ (CSS)
Web Development & Design Foundations with HTML5
SEEM4570 Tutorial 5: jQuery + jQuery Mobile
Introduction to HTML.
Project 4 Creating an Image Map.
JavaScript and Events CS Programming Languages for Web Applications
5.00 Apply procedures to organize content by using Dreamweaver. (22%)
Web Client Side Technologies Raneem Qaddoura
Web Programming and Design
Web Software Model CS 4640 Programming Languages for Web Applications
JavaScript and Events CS Programming Languages for Web Applications
Presentation transcript:

JavaScript: BOM and DOM CS 4640 Programming Languages for Web Applications [Robert W. Sebesta, “Programming the World Wide Web Jon Duckett, Interactive Frontend Web Development]

Web Browsers and Objects revisit Object type: Window Properties Location: http://www.cs.virginia.edu/~up3f/cs4640/syllabus.html Object type: Document Properties URL: http://www.cs.virginia.edu/~up3f/cs4640/syllabus.html lastModified: 06/01/2019 10:19:23 Title: CS4640: WebPL

BOM: Browser Object Model revisit BOM – collection of objects that the browser makes available to us for use with JavaScript window Object form Object link Object image Object document Object … DOM location Object history Object document Object navigator Object screen Object … … form Object link Object image Object

DOM: Document Object Model revisit Method What it does write() adds content to the document getElementById() accesses an element of a given id attribute Event Happens when Load page and content have finished loading Click user clicks the mouse over the page Keypress user presses down on a key Object type: Document Properties URL: http://www.cs.virginia.edu/~up3f/cs4640/syllabus.html lastModified: 06/01/2019 10:19:23 Title: CS4640: WebPL

How A Browser See A Web Page revisit document <html> <head> <body> <meta> <title> <link> http-equiv content-type Content text/html ... CS4640: WebPL rel stylesheet href styles/cs4640-style.css ... <a> <header> name top <ul> class navbar ... <div> class container bottom ... <nav> href #top class btn role button ... <button> <h3> class main ... id contact Top class sidebar ... Contact Information The browser receives an HTML page It creates a model of the page and stores it in memory It shows the page on screen using a rendering engine

Using BOM Objects (Some Properties) Property Description window.screenX X-coordinate of pointer, relative to top left corner of screen (in pixels) window.screenY Y-coordinate of pointer, relative to top left corner of screen (in pixels) window.location Current URL of window object window.document Reference to document object window.history Reference to history object for browser window or tab, which contains details of the pages that have been viewed in that window or tab window.history.length Number of items in history object window.screen Reference to screen object window.screen.width Accesses width property of screen object window.screen.height Accesses height property of screen object

Using BOM Objects (Some Methods) Description window.alert( ) Create modal dialog box with message (user must click OK button to close it) window.open(url) Open new browser window with the specified URL window.print( ) Tell browser that user wants to print contents of current page (act like user has clicked a print option) window.history.back( ) Move backward through history window.history.forward( ) Move forward through history window.history.go(step) Move to specific page from session history (step specifies the number of pages, forward or backward) history.pushState(state, title, url) Create a new entry (or add a URL) at the top of the browser history history.replaceState(state, title, url) Modify the current entry (current URL at the top) of the browser history

Using DOM Objects Not part of HTML or JS Separate rules implemented by all major browser markers Two primary purposes: Making a model of the HTML page Specifies how browsers should create a model of an HTML page Accessing and changing the HTML page Specifies how JS can access and update the contents of a web page

DOM: Four Types of Nodes document <html> <head> <body> <meta> <title> <link> http-equiv content-type Content text/html ... CS 4640 (Programming Language for Web Applications) rel stylesheet href styles/cs4640-style.css ... <a> <table> name top <tr> <td> width 75% align center <font> width 100% size +2 <strong> Syllabus — color red Spring 2018 Document node Element node Text node Attribute node

Using DOM Objects (Some Properties and Methods) Property Description document.title Title of current document document.lastModified Date on which document was last modified document.URL String containing URL of current document document.domain Domain of current document Method Description document.write( ) Write text to document document.getElementById(id) Return element whose id attribute matches the specified id document.querySelectorAll(selector) Return list of elements that match the specified CSS selector document.createElement(element) Create new element document.createTextNode(text) Create new text node