Tutorial 5 Windows and Frames Section A - Working with Windows.

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

Copyright ©2005 Department of Computer & Information Science Advanced DHTML & DOM: Working with the Window Object.
Chapter 3 – Web Design Tables & Page Layout
Frames.
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
XP 1 Developing a Basic Web Site Tutorial 2: Web Site Structures & Links.
Multimedia and the World Wide Web HCI 201 Lecture Notes #5A.
The Web Warrior Guide to Web Design Technologies
Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.
XP 1 Designing a Web Site with Frames Using Frames to Display Multiple Web Pages Tutorial 5.
What we learned in last lesson How to add JavaScript to your HTML pages How to use dialog boxes and variables to store and utilize user input How to write.
XP Adding Hypertext Links to a Web Page. XP Objectives Create hypertext links between elements within a Web page Create hypertext links between Web pages.
Chapter 16 Dynamic HTML and Animation The Web Warrior Guide to Web Design Technologies.
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.
Tutorial 8 Designing a Web Site with Frames. XP Objectives Explore the uses of frames in a Web site Create a frameset consisting of rows and columns of.
JavaScript 101 Lesson 5: Introduction to Events. Lesson Topics Event driven programming Events and event handlers The onClick event handler for hyperlinks.
The Power of Tables They aren't just for sitting stuff on anymore...
JavaScript, Third Edition
Create a Web Site with Frames
Copyright © 2004 ProsoftTraining, All Rights Reserved. Lesson 9: Frames © 2007 Prosoft Learning Corporation All rights reserved ITD 110 Web Page Design.
Chapter 6 Working with Frames.
Copyright © 2004 ProsoftTraining, All Rights Reserved. Lesson 9: HTML Frames.
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.
Working with SharePoint Document Libraries. What are document libraries? Document libraries are collections of files that you can share with team members.
4.1 JavaScript Introduction
Department of Information Technology e-Michigan Web Development 0 HTML Form Creation in the Vignette Content Management Application.
Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 9 Scott Marino.
ULI101 – XHTML Basics (Part II) What is Markup Language? XHTML vs. HTML General XHTML Rules Block Level XHTML Tags XHTML Validation.
XP 1 Tutorial 5 Using Frames in a Web Site. XP 2 Tutorial Objectives  Describe the uses of frames in a Web site  Lay out frames within a browser window.
XP Using Frames in a Web Site Ali Alfayly. XP Tutorial Objectives Create frames for a Web site Control the appearance and placement of frames Control.
XP New Perspectives on Browser and Basics Tutorial 1 1 Browser and Basics Tutorial 1.
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
Unobtrusive JavaScript
Chapter 8 OBJECT-ORIENTED TECHNOLOGIES AND DSS DESIGN Decision Support Systems For Business Intelligence.
UFCEWT-20-3 Advanced Topics in Web Development Lecture 4 : JavaScript, Browsers & the HTML DOM-API.
Arrays – What is it? – Creation – Changing the contents Functions – What is it? – Syntax – How they work – Anonymous functions A quick lesson in Objects.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
Tutorial 8 Designing a Web Site with Frames. XP Objectives Explore the uses of frames in a Web site Create a frameset consisting of rows and columns of.
JavaScript, Fourth Edition
Writing a JavaScript User-Defined Function  A function is JavaScript code written to perform certain tasks repeatedly  Built-in functions.
Using Client-Side Scripts to Enhance Web Applications 1.
Introduction to JavaScript 41 Introduction to Programming the WWW I CMSC Winter 2004 Lecture 17.
CSCE 102 – Chapter 6 (Web Design and Layout) CSCE General Applications Programming Benito Mendoza Benito Mendoza 1 By Benito Mendoza.
Tutorial 5 Windows and Frames Section B - Working with Frames and Other Objects Go to Other Objects.
Chapter 5: Windows and Frames
XP Tutorial 6 New Perspectives on JavaScript, Comprehensive1 Working with Windows and Frames Enhancing a Web Site with Interactive Windows.
Tutorial 8 Designing a Web Site with Frames. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore the uses of frames.
XP 1 HTML Tutorial 2: Developing a Basic Web Site.
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
XP Tutorial 8 Adding Interactivity with ActionScript.
1 HTML Frames
Project 10: Exploring the Window Object Essentials for Design JavaScript Level One Michael Brooks.
JavaScript, Fourth Edition Chapter 4 Manipulating the Browser Object Model.
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Working with Windows (No audio component) © Dr. David C. Gibbs
HTML Overview Part 5 – JavaScript 1. Scripts 2  Scripts are used to add dynamic content to a web page.  Scripts consist of a list of commands that execute.
Project 5: Using Pop-Up Windows Essentials for Design JavaScript Level One Michael Brooks.
CISW CRC - Fishman 2014 / 2015 PRESENTATION 4b: CISW 400 (Online) – Client-side Scripting for the Internet Cosumnes River College Fishman – 2015.
Tutorial 11 1 JavaScript Operators and Expressions.
1 HTML Frames
Microsoft FrontPage 2003 Illustrated Complete Creating a Frames Page.
XP Tutorial 8 Adding Interactivity with ActionScript.
Working with the Window Object JavaScript considers the browser window an object, which it calls the window object.
Adding Javascript How to include javascript in a webpage.
JavaScript and Ajax (JavaScript Functions) Week 5 Web site:
1 Lesson 6 Introducing JavaScript HTML and JavaScript BASICS, 4 th Edition.
XP New Perspectives on Macromedia Dreamweaver MX 2004 Tutorial 5 1 Adding Shared Site Elements.
Project 9 Creating Pop-up Windows, Adding Scrolling Messages, and Validating Forms.
Programming the Web using XHTML and JavaScript
Windows The Window Objects.
Presentation transcript:

Tutorial 5 Windows and Frames Section A - Working with Windows

Tutorial 5A Topics Section A - Working with Windows About the browser object model About the window object How to open and close windows How to work with timeouts and intervals

Objects Objects are special variables that representprograms Objects contain two categories of information: Variables (called properties) Functions (called methods)

Working with Windows The JavaScript Object Model Browser object model A hierarchy of objects, each of which provides programmatic access to a different aspect of the HTML page or the Web browser window Created automatically when a Web browser opens an HTML document

Working with Windows The JavaScript Object Model Window object Represents a Web browser window or an individual frame within a window Top-level object in the browser object model Its properties and methods can be used to control the Web browser window

Working with Windows The JavaScript Object Model Document object Represents an HTML document displayed in a window Descended from a Window object Ancestor (parent) for all elements contained on an HTML page e.g., all HTML elements descend from the Document object

Working with Windows The JavaScript Object Model Referencing objects To refer to a JavaScript object in code, you must list all of its ancestors as a series of properties separated by periods (the dot operator) It is not necessary to explicitly refer to the Window object, it is assumed by the browser In some browser versions, it is not necessary to explicitly refer to the Document object

Working with Windows The Window Object Includes several properties that contain information about the Web browser window e.g., status property Contains information displayed in a Web browsers status bar

Working with Windows Opening and Closing Windows Netscape and Internet Explorer both allow the opening of new Web Browser windows Creates a new window object Use open() method of the Window object Syntax window.open(URL, name, options);

Working with Windows Opening and Closing Windows window.open(URL, name, options); URL: the address of the content of the window Name: use this as the value of a target in HTML tags. If a window with this name already exists, open does not create a new window, rather returns a reference to the already opened window. This name cannot be used in javascript code to reference the window (must use a variable) This name does not appear in the title.

Working with Windows Opening and Closing Windows window.open(URL, name, options); URL: the address of the content of the window if the URL is empty, the new window will have no content (i.e., it is blank). Otherwise, the content at the given URL is loaded into the new browser window.

Opening new windows AboutExercise.html. AboutExercise.html. <INPUT TYPE="button" VALUE="About this JavaScript Program" onClick="window.open('About.html', 'About', 'height=100,width=300')"> Note that all options are in a single string.

Working with Windows Opening and Closing Windows When opening a new window, it can be customized using the options argument of the open() method Multiple items in the options string must be separated by commas Defaults are provided if no options are specified If any option is specified, then all desired options must be specified. See example later.

Working with Windows Example. Options specified by listing. Below example will have no toolbars, menubars, directory buttons, or location bar. var myWin = Window.open(Chili.html, Chili, height=350, width=400,scrollbars, resizable, status); Or var myWin = Window.open(Chili.html, Chili, height=350, width=400,scrollbars=yes, resizable=yes, status=yes);

Working with Windows Opening and Closing Windows Referencing a window A Window objects name property can only be used to specify a target window, and cannot be used in JavaScript code To reference a window in code, the new Window object reference must be assigned to a variable var newWindow = window.open(

Working with Windows Opening and Closing Windows Examples About.html Chili.html AnchorTargets.html (opens a new window) Links.html (open links in a new window) PolarBearMain.html (opens a new window, not all options used) Recipies.html (opens new window with some options)

Working with Windows Working with Timeouts and Intervals setTimeout() Used to execute code after a specific amount of time has elapsed Executes only once Syntax: var variable setTimeout(code, milleseconds); clearTimeout() Used to cancel a setTimeout() method

Working with Windows Working with Timeouts and Intervals 1000 millisecond = 1 second

Working with Timeouts See examples: guessNumber.html (setTimeOut in a game) Redirect.html (redirect a page after a timeout)

Working with Windows Working with Intervals setInterval() Similar to setTimeout() except it repeatedly executes the same code after being called once Syntax: var variable setInterval(code, milleseconds); clearInterval() Used to cancel a setInterval() method

Working with Timeouts See examples: flashGreeting.html (for status bar)

Working with forms Different ways to access elements in an html page. Here we just talk about forms The form and every element in it must be named Refer to elements using the dot notation To access the number/string stored or displayed in an element such as a text box use the value property.

Working with forms See examples: GuessNumber.html GrossPay.html Exercise1A.html Exercise2A.html Exercise3A.html

Random Numbers Javascript has a built-in function to obtain a random number: var theNum = Math.random(); This gets a random number between 0.0 and 1.0 and stores it in the variable theNum

Random numbers function getRand(){ var theNum = Math.random(); // now make the number between 1 and 99 theNum = theNum * 100; // get rid of the decimal part theNum = Math.round(theNum); // use the mod operator to turn the number between 0 and 9. // add 1 to make the number between 1 and 10 theNum = (theNum % 10) + 1; alert("Your random number is " + theNum); } <input type="button" value= "Random Number onClick="getRand();" style="background-color:darkred;color:blue">