UNIT 3 DYNAMIC WEBSITES WITH CSS AND JAVASCRIPT. OBJECTIVES  CO4 Apply style to a website using CSS.  CO5 Describe the use of scripting when creating.

Slides:



Advertisements
Similar presentations
Introducing JavaScript
Advertisements

CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
CSS Layout Crash Course An Advance CSS Tutorial. Inline vs. Block Many HTML elements have a default display setting of Block. Block elements take up the.
Cascading Style Sheets
INTRODUCTION TO HYPERTEXT MARKUP LANGUAGE 1. Outline  Introduction  Markup Languages  Editing HTML  Common Tags  Headers  Text Styling  Linking.
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
Cascading Style Sheets. CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements. CSS is a.
INTRODUCTORY Tutorial 7 Creating Liquid Layouts. XP Objectives Discern the differences among various types of layouts Create a liquid layout Create a.
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
The Web Warrior Guide to Web Design Technologies
Today’s objectives Site performance Padding, Margins, Borders
Lecture 6 8/11/11.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Tutorial 10 Programming with JavaScript
XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
MORE Cascading Style Sheets (The Positioning Model)
4.01 Cascading Style Sheets
XP Tutorial 1 New Perspectives on JavaScript, Comprehensive1 Introducing JavaScript Hiding Addresses from Spammers.
Create a Web Site with Frames
Working with Cascading Style Sheets. 2 Objectives Introducing Cascading Style Sheets Using Inline Styles Using Embedded Styles Using an External Style.
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
XP Tutorial 5New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Designing a Web Site with Frames Using Frames to Display Multiple Web Pages Tutorial.
CSS (Cascading Style Sheets): How the web is styled Create Rules that specify how the content of an HTML Element should appear. CSS controls how your web.
TUTORIAL 8: Enhancing a Web Site with Advanced CSS
Introduction to PHP and Server Side Technology. Slide 2 PHP History Created in 1995 PHP 5.0 is the current version It’s been around since 2004.
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
ITP 104.  While you can do things like this:  Better to use styles instead:
CS346 - Javascript 1, 21 Module 1 Introduction to JavaScript CS346.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
SYST Web Technologies SYST Web Technologies Lesson 6 – Intro to JavaScript.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
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.
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Today’s objectives  Assignment 1  Padding, Margins, Borders  Fluid Layout page  Building accessible Table  Element size with padding and border 
What is Java Script? An extension to HTML. An extension to HTML. Allows authors to incorporate some functionality in their web pages. (without using CGI.
 Website development process  CSS  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.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Tutorial 10 Programming with JavaScript. XP Objectives Learn the history of JavaScript Create a script element Understand basic JavaScript syntax Write.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Tutorial 7.
Tutorial #6 – Creating Fixed Width Layouts. Tutorial #5 Review – Box Model Every html element is surround by a box Content, Padding, Border, Margin Can.
JavaScript Syntax, how to use it in a HTML document
Advanced Web Development Instructor: Thomas Bombach.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
JavaScript. JavaScript is the programming language of HTML and the Web. Easy to learn One of the 3 languages of all developers MUST learn: 1. HTML to.
CNIT 132 – Week 4 Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of.
1 JavaScript in Context. Server-Side Programming.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
CONTROLLING Page layout
Positioning Objects with CSS and Tables
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Coding with HTML {. THE BASICS { What is HTML and how can you use it to make websites?
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
CS 120: Introduction to Web Programming Lecture 10: Extra Features and Website Design Part 1 Tarik Booker CS 120 California State University, Los Angeles.
Javascript Prof. Wenwen Li School of Geographical Sciences and Urban Planning 5644 Coor Hall
CSS.
Chapter 6 JavaScript: Introduction to Scripting
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
JavaScript What is JavaScript? What can JavaScript do?
JavaScript What is JavaScript? What can JavaScript do?
Presentation transcript:

UNIT 3 DYNAMIC WEBSITES WITH CSS AND JAVASCRIPT

OBJECTIVES  CO4 Apply style to a website using CSS.  CO5 Describe the use of scripting when creating a website.  CO6 Create a dynamic website using JavaScript. 2

LEARNING OUTCOMES LO12 Create a fixed-layout Web page using CSS. LO13 Create a liquid-layout Web page using CSS. LO14 Create a hybrid Web page using CSS. LO15 Describe server-side scripting. LO16 Describe client-side scripting. LO17 Create a JavaScript event handler. LO18 Display random content using JavaScript. LO19 Document JavaScript code using comments. 3

FIXED LAYOUTS The body of the page has a specific width. Width is controlled by a master wrapper.  Specified in pixels Determine the minimum screen resolution you want to accommodate:  800x600 was common.  Now, many Web designers use 1024x768 as a minimum. 4

FIXED WIDTH - SMALLER SIZE SCREEN 5 Horizontal scrollbars

FIXED WIDTH - LARGER SIZE SCREEN 6

LIQUID LAYOUTS  Often use a where width is specified as a percentage  Require a significant amount of testing 7

LIQUID LAYOUT - SMALL SCREEN SIZE 8

LIQUID LAYOUT - VERY SMALL SCREEN 9

LIQUID LAYOUT - LARGE SCREEN 10

CREATING A HYBRID LAYOUT 1.Start with a basic layout structure. 2.Create a header and footer. 3.Define two fixed columns on either side. 4.Define a liquid column in the middle. 11

BASIC LAYOUT STRUCTURE <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" " Sample Layout HEADER CONTENT LEFT SIDE RIGHT SIDE FOOTER 12

HEADER AND FOOTER #header { float: left; width: 100%; background-color: #7152F4; } #footer { float: left; width: 100%; background-color: #7152F4; } 13

WRAPPER #wrapper { float: left; padding-left: 200px; padding-right: 125px; } 14

LEFT SIDE #left_side { position: relative; float: left; width: 200px; background-color: #52f471; right: 200px; margin-right: -100%; } 15

RIGHT SIDE #right_side { position: relative; float: left; width: 125px; background-color: #f452d5; margin-right: -125px; } 16

CONTENT AREA #content_area { position: relative; float: left; background-color: #ffffff; width: 100%; } 17

HYBRID LAYOUT 18

HYBRID LAYOUT Problem under 400 pixels 19

SETTING MIN-WIDTH body { margin: 0; padding: 0; min-width: 525px; } 20

MANAGING COLUMN HEIGHT Add the following to left_side, right_side, and content_area: margin-bottom: -2000px; padding-bottom: 2000px; Add the following to the footer: position: relative; Add the following to the wrapper: Overflow: hidden; 21

HYBRID LAYOUT COMPLETE 22

Server-side scripting  PHP  JSP  ASP  Perl  Python  Ruby Client-side scripting  JavaScript  VBScript  jQuery  Ajax 23 SCRIPTING

Server-side  The script is executed by the Web server.  Browser- independent  Requires a trip across the Internet Client-side  The script is executed by the browser.  Support can differ by browser  Can execute without a trip across the Internet 24 CLIENT-SIDE vs. SERVER-SIDE

WHERE TO PUT JAVASCRIPT  In its own file with a.js extension  In a block in the HTML Typically in the block  Is not executed unless called Can be placed in the block  Is executed when the page loads Associated with an event 25

INLINE JAVASCRIPT EXAMPLE JavaScript Example JavaScript Example This text is HTML. <!-- Hide the script from old browsers document.write(' This text comes from JavaScript. '); // Stop hiding the script --> 26

JAVASCRIPT EXAMPLE OUTPUT 27

ABOUT JAVASCRIPT  Case-sensitive  White space is ignored except inside of quotes. Use + to concatenate strings that span multiple lines  Add a semicolon after a statement: hours = now.getHours(); mins = now.getMinutes(); secs = now.getSeconds();  Use comments to document: // Initialize the arrays with quotes /* This is a multiline comment So you can comment out a block of code */ 28

VARIABLES AND FUNCTIONS var text; text = prompt(“Enter some text.”); 29 Parameter Variable to store return value Variable declaration

OBJECTS  Store multiple pieces of data, known as properties object.property Bob.address Bob.phone  Can include methods Bob.display() 30

TYPES OF OBJECTS  Built-in objects  DOM objects  Custom objects 31

ARRAYS  An array stores a list of values.  Each item in the list can be accessed through its index. 32 MarkDavidSarah 012

PARALLEL ARRAYS 33 MarkDavidSarah 012 ApplePearOrange 012

USING ARRAYS  Declare array variables: quotes = new Array(4); sources = new Array(4);  Store values in an array: quotes[0] = "When I was a boy of 14, my father was so " + "ignorant...but when I got to be 21, I was astonished at " + "how much he had learned in 7 years."; sources[0] = "Mark Twain"; 34

RANDOM NUMBER i = Math.floor(Math.random() * quotes.length);  Math.random() returns a random number between 0 and 1.  Multiply the random number by the number of quotes.  Math.floor rounds the result down. 35

CONDITIONALS Do something if a specific condition exists if (count==1) alert(“The countdown has reached 1.”); 36

LOOPS for (i=1; i<=10; i++) { alert(“It's another alert!”); } 37

EVENT HANDLERS 38

WHICH SCRIPT RUNS FIRST?  tags within the section Cannot create output in the Web page  tags within the section Executed in order Event handlers are executed when events happen. 39

DOCUMENT OBJECT MODEL 40 documentwrapperstyle background- color content_areastylecolorproduct_imgsrc

IMAGE DISPLAYED ON ROLLOVER 41 <a href="#" onmouseover="javascript:document.product_img.src = '/path/to/large4.jpg'"><img src="/path/to/small4.jpg" width="104" height="104" style="padding: 4px; border: 0px" alt="photo" />

IMAGE DISPLAYED ON ROLLOVER Result: 42

JAVASCRIPT SYNTAX RULES Case Sensitivity  Keywords are always lowercase.  Built-in objects are capitalized.  DOM object names are usually lowercase.  DOM methods often contain a mix of upper- and lowercase. 43

JAVASCRIPT SYNTAX RULES Variable, Object, and Function Names  Can include: Uppercase letters Lowercase letters Numbers Underscore (_)  Must begin with a letter or underscore  Variable names cannot be reserved words. 44

JAVASCRIPT BEST PRACTICES  Use comments liberally.  Use a semicolon at the end of each statement.  Use one statement per line for easier debugging.  Use separate JavaScript files when possible.  Avoid being browser-specific.  Keep JavaScript optional. 45