COSC 109 chapter 8
Document Tags
-<html> tag -<head> tag -<title> Tag -<body> Tag
JavaScript
-A scripting language for Web pages -Can be used to: -add interactivity -generate content on the Web page based on the viewer's choice -validate online forms before submission -create and track cookies
<html> tag
-Encloses the document -Tells the browser that this is the start of an HTML document -End tag </html> is placed at the end of the HTML document
Site Root-Relative Paths
-Example: /products/coffee/french-roast.html -Starts with a slash (/), meaning starting from the root folder of the site -A root folder is the outermost folder of the site
Absolute Paths
-Example: http://www.mysite.com/products/coffee/french-roast.html -Full URL to a Web page or any media -Used for linking to files that are on a different Web site
Document-Relative Paths
-Example: products/coffee/french-roast.html -Most commonly used in Web authoring -The path is relative to the page that french-roast.html is being requested
review
-HTML files are text files. -Tags are the markup codes in an HTML document that tell a web browser how to format the text when the text is displayed.
<head> tag
-Its element content is information about the document -<title> -function definitions of JavaScript -links to external JavaScript and style sheets -Header information is not displayed in the body of the browser window
<title> Tag
-Its element content is the title of the document -The title is displayed on the Window bar of the browser window -The title is used as the bookmark for the page
Dynamic HTML (DHTML)
-Not a programming language by itself, but a combination of HTML, CSS, and JavaScript -When combined with CSS, JavaScript can be used to dynamically control properties such as: -text styles -text color -visibility of HTML elements -positioning of HTML elements (and hence create animation) -image file to be used for an image element (and hence create animation)
XHTML
-Stands for Extensible Hypertext Markup Language -Intended to be a replacement for HTML -Most of the tags are the same as those in HTML -Has stricter rules for writing HTML -These stricter rules are also supported but not enforced in HTML
URL
-Stands for Uniform Resource Locator standard for specifying the address of Web pages and other resources on the World Wide Web -Example: http://www.schoolname.edu/departments/compsci/index.html -The address is made up of segments of standard information: 1.http:// http stands for Hypertext Transfer Protocol The protocol specifies a set of rules that govern how the information transfer between the Web server and the Web client (the computer that requests to view the page) 2.www.schoolname.edu This is the domain name of the Web server 3.departments/compsci/index.html This is the file path of the document index.html The file path is the location information of the page on the Web server In this example, the document index.html is in a folder called compsci, which in turn is located in a folder called departments
Markup Tag
-Tells the Web browser the format of the text -Surrounded by < > -Examples: -paragraph tag: <p> -In pairs: start tag and end tag (closing tag) -Example: -start tag: <p> -end tag: </p> -Placement of start and end tags -Example: <p>This is a paragraph.</p> (look at powerpoint)
HTML 5
-The newest standard of HTML -Its specifications are still a work in progress (at the time of writing the book) -New features of HTML 5 include: -video and audio tags -content-specfic tags: footer, header, nav, article, section, figure, summary, aside -tags for form elements -canvas element: -allows drawing graphics and displaying images dynamically using JavaScript -commonly used for HTML 5 game development -allowing storage and retrieval of data on the user's device using JavaScript
Attributes of a Tag
-To specify properties of the element that is marked up the tag -Example: id attribute: <p id="introduction">This is a paragraph.</p> -Placed inside the start tag -In name-value pairs like this: name = "value"
Cascading Style Sheets (CSS)
-Widely used for Web page design and layout -Style sheets allow you to define styles to display HTML elements -Multiple style definitions can be combined or cascaded into one—thus the term cascading style sheets -Style sheet files are text files -The styles defined in the files follow specific rules and syntax
HTML document
-a plain text file, that can be created using: -a text editor (notepad in windows, or textEdit in Mac OS) -a Web Page editor
web browser
-an application that can interpret HTML and display the document in the format and layout according to the markup tags -ex. firefox, internet, explorer, safari, chrome,opera
web page editor
-example: microsoft expression web, adobe dreamweaver -allows you to create and edit the page visually without having to manually add markup tags
Nested Tags
-markup elements can be nested in another element (i.e.,placed within another element's content.) -Example: -header and body elements are nested inside <html> -title element is nested inside <head>
Basic Structure of an HTML Document
<html> <head> <title>This is a title.</title> </head> <body> This is the content of the Web page. </body> </html>
Types of File Paths for Web Documents
Absolute paths Document-relative paths Site root-relative paths
Tags That Do Not Have Element Content
Examples: -line break: <br></br> can be written as: <br /> -image tag: <img></img> can be written as: <img />
<body> Tag
Its element content is what will be displayed in the browser window
File Path
Location of a file on a computer Like an address to a house Start with the outermost folder to the inner folders Folder names are separated by a slash (/)
To Construct a Document-Relative Path
Need to know: -Target page: The page being linked to -Source page: The page containing the link or the page being linked from Think of the document-relative path as the direction to navigate from the source page to the target page.
End Tag Placement in Nested Tags
Similar to how parentheses are paired in a mathematical equation
To Construct a Document-Relative Path rule #1
To link to another file that is in the same folder as the current document, simply use the filename as the path. Example: To add a link in mocha-java.html (source page) to link to french-roast.html (target page), the file path is simply the filename french-roast.html
web pages
documents that are written in a language called HTML
HTML Markup taga
special codes that tell the web browser how to display the HTML document
HTML
stands for Hypertext Markup Language