1 CSC160 Chapter 9: The Document Object. Outline Document objects Properties of the document object linkColor alinkColor vlinkColor bgColor fgColor lastModified.

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

Internet Services and Web Authoring (CSET 226) Lecture # 5 HyperText Markup Language (HTML) 1.
CSS Link Styling. The Anchor Element: Link text between the opening and closing can be styled using CSS. Some of the properties that can be set are: font-family,
กระบวนวิชา 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.
JavaScript (Part 2) CS 183 4/13/2010. JavaScript (Part 2) Will cover: ◦ For.. In ◦ Events ◦ Try.. Catch, Throw ◦ Objects.
HTML Comprehensive Concepts and Techniques Second Edition Project 8 Integrating JavaScript with HTML.
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.
Web Page Development Identify elements of a Web Page Start Notepad
AdvWeb-1/14 DePaul University SNL 262 Advanced Web Page Design Chapt 10 - Document/location/navigator Objects - Instructor: David A. Lash.
Basic HTML UCR Webmasters Support Group Derk Adams.
JavaScript 101 Lesson 5: Introduction to Events. Lesson Topics Event driven programming Events and event handlers The onClick event handler for hyperlinks.
4.01 Cascading Style Sheets
Colour & Image in HTML Wah Yan College (Hong Kong) Mr. Li C.P.
1 Introduction to HTML. 2  W W W – World Wide Web.  HTML – HyperText Markup Language – The Language  of Web Pages on the World Wide Web. HTML is a.
Lesson 6. Links in HTML Computer Science Welcome to Virtual University in Pakistanhttp://
1 HTML/CSS Tutorial. 2 Definitions WWW -- a software infrastructure layered on top of the Internet HTTP -- HyperText Transport Protocol, layered on top.
Chapter 3 Dreamweaver: Part I The Web Warrior Guide to Web Design Technologies.
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.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
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.
225 City Avenue, Suite 106 Bala Cynwyd, PA , phone , fax presents… HTML Lists, Tables and Forms v2.0.
The Document Object Model. Goals Understand how a JavaScript can communicate with the web page in which it “lives.” Understand how to use dot notation.
Web Pages: Creating & Maintaining Body Tags. There have been several versions of HTML since its inception. VersionYear HTML1991 HTML HTML
1 Background and Text Links CGS3066 Rory J. De Simone.
1 CSC 121 Computers and Scientific Thinking David Reed Creighton University HTML and Web Pages.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
Kevin Murphy Web Color Basics Masters Project CS 490.
Suzanne J. Sultan Javascript Lecture 2. Suzanne J. Sultan function What is a function> Types of functions:  Function with no parameters  Function with.
More Basic XHTML Module 2: XHTML Basics LESSON 2.
Chapter 6 An Introduction to HTML Pages Tag Nesting You can put two tags together to combine the effects Bold and underlined But make sure.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
Integrating JavaScript and HTML5 HTML5 & CSS 7 th Edition.
Objective Static vs. Dynamic Web pages. Variables. Assignments. JavaScript Hierarchy of Objects JavaScript Functions (prompt(“”,””) Document.write(“”)
Scripting Language A scripting language or script language is a programming language that supports the writing of scripts. The term script is typically.
HTML Basic IST2101. Keep In Mind Programming can be time consuming. Plan ahead!
Academic Year, Spring Semester Bilkent University - Faculty of Art, Design and Architecture Department of Communication and Design CS 153 Introduction.
Project 9: Exploring the Document Object Essentials for Design JavaScript Level One Michael Brooks.
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.
The Teacher Computing HTML HyperText Markup Language.
HTML(Hyper Text Markup Language) ByNaveen. Introduction HTML or Hyper Text Markup Language is the standard markup language Its used to create the web.
XHTML Formatting font with a style declaration. Formatting Font HTML uses the font tag to change size and family of font But… the font tag is being deprecated.
Body and Heading Tags and their Attributes. Attribute Name DefinitionValues backgroundIndicates the background image of the Web page. Ex. Filename(path.
12/20/20151 Color Fall, 2010 Modified by Linda Kenney 10/26/10.
HTML (Hyper Text Markup Language) Lecture II. Review Writing HTML files for web pages – efficient compact – fundamental. Text files with htm extension.
HTML – The Basics COE 201- Computer Proficiency. The Internet The World Wide Web ▫Also known as the Web ▫Created in 1989  European Laboratory for Particle.
Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing a Line of Text in a Web Page 7.3 Another JavaScript.
Spiderman ©Marvel Comics Creating Web Pages (part 1)
HTML CS 105. Page Structure HTML elements control the details of how a page gets displayed. Every HTML document has the following basic structure: … …
Basic HTML Programming Technology Education Ellsworth Community Middle School Communication Systems.
JavaScript Object Model. Biggest Advantage of JavaScript  I can access values of HTML elements using JavaScript  I can modify values of HTML elements.
Scripting with Client-Side Processing Scripting with Client Side Processing Lesson – Web Technologies Copyright © Texas Education Agency, All rights.
HTML-I Basic HTML Elements. HTML (Hyper Text Markup Language) HTML is a document layout and hyperlink- specification language. i.e. a language used to.
NASRULLAHIBA.  It is time to take your web designing skills to the next level with Cascading Style Sheets (CSS). They are a way to control the look and.
1 CSC160 Introduction to HTML. 2 What Is a Computer?  A computer is a programmable machine that can store data, interacts with users and devices, and.
INTERNET APPLICATIONS CPIT405 Forms, Internal links, meta tags, search engine friendly websites.
1 JavaScript and Dynamic Web Pages Lecture 7. 2 Static vs. Dynamic Pages  A Web page uses HTML tags to identify page content and formatting information.
1 Introduction to HTML. 2 Definitions  W W W – World Wide Web.  HTML – HyperText Markup Language – The Language of Web Pages on the World Wide Web.
1 R3 R1 R5 R4 R6 R2 B B A A Looking at the Code Under the View menu Select Source.
HTML is the language that allows text and graphics to be displayed as Web pages. It is a set of special codes, called tags, that tells a browser application.
COM621: Advanced Interactive Web Development Lecture 6 – JavaScript (cont.)
COM621: Advanced Interactive Web Development Lecture 5 – JavaScript.
4.01 Cascading Style Sheets
Introduction to HTML.
14 A Brief Look at JavaScript and jQuery.
BY: SITI NURBAYA ISMAIL FACULTY of COMPUTER and MATHEMATICAL SCIENCES
4.01 Cascading Style Sheets
More JavaScript.
IDT Links in HTML What you need to know….
Presentation transcript:

1 CSC160 Chapter 9: The Document Object

Outline Document objects Properties of the document object linkColor alinkColor vlinkColor bgColor fgColor lastModified Methods of the document object Open() Close() 2

3 Document Objects The document object is an object that is created by the browser for each new HTML page (document) that is viewed. JavaScript gives you access to a number of properties and methods that can affect the document in various ways. E.g., document.write() method can write some content into a page.

Properties of the Document Object PropertiesDescription alinkColorthe color of activated links in the document (Alink attribute). bgColorthe background color of the document. fgColorthe default text color of the document (text attribute). lastModified the last modified date of the document, as reported by the web server. linkColorthe color of unvisited links in the document (link attribute). titlethe title of the document. Read/write in modern browsers. URLA string that specifies the complete URL of the document. vlinkColorthe color of visited links in the document (vlink attribute). 4

5 The linkColor Property The linkColor property holds the value of the unvisited link color for the HTML document. linkcolor <!-- document.linkColor = "green"; //--> link to dell <!— document.write("The link color is " + document.linkColor); //-->

6 The alinkColor Property The alinkColor property holds the value of the active link color (the color of a link when it is clicked) for the HTML document. Two ways to set the active link color: Using HTML, set the color in the opening BODY tag in the alink attribute. Using JavaScript, set the color through the alinkColor property of the document. Use color name string or the hexadecimal red-green-blue (RGB) value as a string. Format: “#rrggbb”. We can display the value of the alinkColor property of the current document. The RGB code will be displayed

7 The alinkColor Property: HTML Approach alinkcolor1 link to yahoo <!-- document.write("The active link color is " + document.alinkColor); //-->

8 The alinkColor Property: JavaScript Approach alinkcolor2 <!-- document.alinkColor = "red"; //--> link to weather <!-- document.write("The active link color is " + document.alinkColor); //-->

9 The vlinkColor Property The vlinkColor property holds the value of the visited link color (the color of a link after it has been visited) for the HTML document. vlinkcolor.htm <!-- document.vlinkColor = "green"; //--> link to EKU <!-- document.write("The visited link color is " + document.vlinkColor); //-->

10 The bgColor Property The bgColor property holds the value of the background color for the HTML document. Two ways to set the background color: Using HTML, set the color in the opening BODY tag in the bgcolor attribute. Using JavaScript, set the color through the bgColor property of the document. Use color name string or the hexadecimal red-green- blue (RGB) value as a string.

11 The bgColor Property (cont’d) bgcolor1.htm <!-- document.write("The background color here is " + document.bgColor); //-->

12 The bgColor Property (cont’d) bgcolor2.htm <!-- document.bgColor = "lightblue"; document.write("The background color here is " + document.bgColor); //-->

13 The bgColor Property: An Example Change background color by clicking buttons Background clolors <!-- function newbg(thecolor) { document.bgColor = thecolor; } //--> Want a mew background color, change the color by clicking a button below! &nbsp &nbsp &nbsp

14 The fgColor Property The fgColor property holds the value of the text color. Two methods to set the text color Use the text attribute in the opening BODY tag Use the fgColor property of the document object fgcolor1.htm <!-- document.write("The text color here is " + document.fgColor); //-->

15 The fgColor Property (cont’d) fgcolor2.htm <!-- document.fgColor = "orange"; document.write("The text color here is " + document.fgColor); //-->

16 The lastModified Property The lastModified property holds the value of the data and time that the current document was last modified. lastmodified.htm <!-- document.write("Last updated: " + document.lastModified); //-->

17 Methods of the Document Object The open() method is used to open a new document and create its contents entirely with document.write() or document.writeln() statements. The close() method closes an output stream previously opened with the document.open() method and forces data collected from any instances of the document.write() or document.writeln() methods to be displayed.

18 Methods of the Document Object (cont’d) openclose.htm <!-- function newpage() { var thename = document.myform.yourname.value; document.open(); document.write(" Welcome! "); document.write("Hello, " + thename + ", welcome to my page!"); document.close(); } //--> To be continued...

19 Methods of the Document Object (cont’d) Enter your name in the box below, then click the button to see a personalized page! Name: