Mark Dixon, SoCCE SOFT 131Page 1 02 – Dynamic HTML (client-side scripting)

Slides:



Advertisements
Similar presentations
Computer and Communication Fundamental Basic web programming Lecture 8 Rina Zviel-Girshin.
Advertisements

The Web Warrior Guide to Web Design Technologies
Mark Dixon, SoCCE SOFT 136Page 1 02 – Software Development Life-Cycle.
COMPSCI 345 / SOFTENG 350 TUTORIAL WEEK 8 | SAM KAVANAGH.
Mark Dixon, SoCCE SOFT 131Page 1 20 – Web applications: HTML and Client-side code.
JavaScript- Introduction. What it is and what it does? What it is? It is NOT Java It is NOT Server-side programming Users can see code It is a client-side.
Mark Dixon Page 1 02 – Dynamic HTML (client-side scripting)
Mark Dixon, SoCCE SOFT 131Page 1 03 – Debugging & Graphics.
Mark Dixon, SoCCE SOFT 131Page 1 16 – Web applications: HTML and Client-side code.
Information Technology Center Hany Abdelwahab Computer Specialist.
Web Page Development Identify elements of a Web Page Start Notepad
Mark Dixon, SoCCE SOFT 131Page 1 03 – Information Processing: Expressions, Operators & Functions.
Mark Dixon, SoCCE SOFT 131Page 1 04 – Conditional Execution.
JavaScript 101 Lesson 5: Introduction to Events. Lesson Topics Event driven programming Events and event handlers The onClick event handler for hyperlinks.
Mark Dixon, SoCCE SOFT 131Page 1 03 – Debugging, Sound, and Graphics.
Mark Dixon, SoCCE SOFT 131Page 1 19 – Web applications: Server-side code (ASP)
Cos 381 Day 7. © 2006 Pearson Addison-Wesley. All rights reserved. 6-2 Agenda Assignment 2 Posted –Program a web-based Version of Soduku using JavaScript.
Mark Dixon, SoCCE SOFT 131Page 1 02 – Software Development Lifecycle, & User Interface Design.
Introduction to Javascript. Web Page Technologies To create Web Page documents, you use: To create Web Page documents, you use: HTML – contents and structures.
Introduction to JavaScript. Aim To enable you to write you first JavaScript.
1 Events Lect 8. 2 Event-driven Pages one popular feature of the Web is its interactive nature e.g., you click on buttons to make windows appear e.g.,
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
Introduction to JavaScript. JavaScript Facts A scripting language - not compiled but interpreted line by line at run-time. Platform independent. It is.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
02 – Client-side code: JavaScript
Event Handlers CS101 Introduction to Computing. Learning Goals Learn about event handlers Determine how events are useful in JavaScript Discover where.
JavaScript 1. What is JavaScript? JavaScript allows web authors to create dynamic pages that react to user interaction. It is an Object-based because.
JavaScript is a client-side scripting language. Programs run in the web browser on the client's computer. (PHP, in contrast, is a server-side scripting.
Mark Dixon Page 1 3 – Web applications: Server-side code (JSP)
Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and check boxes using HTML Add a pull-down.
M Dixon 1 04 – Data Types & Debugging. Questions: Expressions a)What is the result of: 7 + Int(8.245) b)Write an expression to: put a random number into.
Lesson13. JavaScript JavaScript is an interpreted language, designed to function within a web browser. It can also be used on the server.
Mark Dixon, SoCCE SOFT 131Page 1 02 – Dynamic HTML (client-side scripting)
Mark Dixon Page 1 18 – Web applications: Server-side code (PhP)
Mark Dixon, SoCCE SOFT 131Page 1 03 – Information Processing: Expressions, Operators & Functions.
Introduction to Javascript. What HTML Can & Can Not Do HTML Can HTML Can Display text Display text Display images Display images Display even animated.
Mark Dixon, SoCCE SOFT 131Page 1 05 – Variables. Mark Dixon, SoCCE SOFT 131Page 2 Admin: Test (next week) In class test –teaching week 6 –university week.
Mark Dixon Page 1 Web-Application Development Workshop.
Mark Dixon Page 1 03 – Dynamic HTML (client-side scripting)
M Dixon 1 03 – Dynamic HTML (client-side scripting)
Mark Dixon Page 1 04 – Information Processing: Expressions, Operators & Functions.
SERVER web page repository WEB PAGE instructions stores information and instructions BROWSER retrieves web page and follows instructions Server Web Server.
Lecture 10 JavaScript: DOM and Dynamic HTML Boriana Koleva Room: C54
44238: Dynamic Web-site Development Client Side Programming Ian Perry Room:C48 Extension:7287
Cs332a_chapt10.ppt CS332A Advanced HTML Programming DHTML Dynamic Hypertext Markup Language A term describing a series of technologies Not a stand-a-lone.
Mark Dixon, SoCCE SOFT 131Page 1 04 – Information Processing: Expressions, Operators & Functions.
Mark Dixon Page 1 03 – Dynamic HTML (client-side scripting)
Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 8 Scott Marino.
JavaScript Making Web pages come alive. Objectives Be able to read JavaScript scripts Be able to write JavaScript scripts.
Changing text colour with mouse over effect Activity 5 Procedure 1. Start Dreamweaver and select the ‘Hong Kong Scenery’ web site. 2. Open the web page.
M Dixon 1 Tech HTML. M Dixon 2 Admin Attendance Register: –log in to your profile.
Mark Dixon Page 1 Soft – HTML. Mark Dixon Page 2 Admin Attendance Register: –log in to your profile.
Mark Dixon Page 1 Tech – HTML. Mark Dixon Page 2 Admin Attendance Register: –log in to your profile.
By Tharith Sriv. To write a web page you use: HHTML (HyperText Markup Language), AASP (Active Server Page), PPHP (HyperText Preprocessor), JJavaScript,
Mark Dixon Page 1 04 – Information Processing: Expressions, Operators & Functions.
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
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.
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Variables, Functions and Events (NON-Audio version) © Dr. David C. Gibbs WDMD.
Mark Dixon Page 1 15 – Web applications: Server-side code (ASP)
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
M Dixon 1 02 – Dynamic HTML (client-side scripting)
Mark Dixon Page 1 03 – Information Processing: Expressions, Operators & Functions.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
Chapter 6 Dynamic Documents with JavaScript. © 2006 Pearson Addison-Wesley. All rights reserved Introduction Def: A dynamic HTML document is.
Mark Dixon, SoCCE SOFT 131Page 1 03 – Conditional Execution.
SE-2840 Dr. Mark L. Hornick 1 Dynamic HTML Handling events from DOM objects.
Web Development & Design Foundations with HTML5 7th Edition
Introduction to JavaScript
Web Design and Development
Web Programming and Design
Presentation transcript:

Mark Dixon, SoCCE SOFT 131Page 1 02 – Dynamic HTML (client-side scripting)

Mark Dixon, SoCCE SOFT 131Page 2 Jobs Computer weekly (jobs in 7 days before 29 th September 2005): –java2234 –VB1614 –ASP1355 –php 215 –flash 168 –dreamweaver 69

Mark Dixon, SoCCE SOFT 131Page 3 Questions: HTML Consider the following HTML: Next Page Give an example of a tag Give an example of an element Give an example of an attribute Next Page href=“next.htm”

Mark Dixon, SoCCE SOFT 131Page 4 Questions: HTML Is the following a tag? Hello Is the following an element? Is the following an attribute? How many tags are there in: Title How many attributes are there in: No (element) No (start tag) 4 2

Mark Dixon, SoCCE SOFT 131Page 5 Session Aims & Objectives Aims –introduce you to the fundamental aspects of dynamic (interactive) web pages via client-side scripting Objectives, by end of this week’s sessions, you should be able to: –make your web-pages more dynamic/interactive using client-side script

Mark Dixon, SoCCE SOFT 131Page 6 Dynamic processing (what) HTML is static –identical on each load –very limiting Dynamic processing –client-side: browser (this week) quicker (no request-response cycle) insecure (view source) limited (can't access server-side databases) –server-side: server application (later weeks) slower more powerful

Mark Dixon, SoCCE SOFT 131Page 7 Controls Input tags –allow user to control page Login

Mark Dixon, SoCCE SOFT 131Page 8 Example: Colour Change Trigger (when)Actions (what) Click event of Red button Change background to Red MouseOver event of Red button Make button text capitals (RED) MouseOut event of Red button Make button text normal (Red) Click event of Blue button Change background to Blue MouseOver event of Blue button Make button text capitals (BLUE) MouseOut event of Blue button Make button text normal (Blue) Events: –Click: user releases left mouse button on object –MouseOver: mouse moves over object –MouseOut: mouse mouse moves off object

Mark Dixon, SoCCE SOFT 131Page 9 Tags First Dynamic Page Sub btnRed_OnClick() document.bgcolor = "red" End Sub Sub btnRed_OnMouseOver() btnRed.Value = "RED" End Sub Sub btnRed_OnMouseOut() btnRed.Value = "Red" End Sub Use tags to create buttons

Mark Dixon, SoCCE SOFT 131Page 10 Tag First Dynamic Page Sub btnRed_OnClick() document.bgcolor = "red" End Sub Sub btnRed_OnMouseOver() btnRed.Value = "RED" End Sub Sub btnRed_OnMouseOut() btnRed.Value = "Red" End Sub Visual BASIC Script Use tags to enclose script code

Mark Dixon, SoCCE SOFT 131Page 11 Event Handler Procedures First Dynamic Page Sub btnRed_OnClick() document.bgcolor = "red" End Sub Sub btnRed_OnMouseOver() btnRed.Value = "RED" End Sub Sub btnRed_OnMouseOut() btnRed.Value = "Red" End Sub Event Handler Procedure

Mark Dixon, SoCCE SOFT 131Page 12 Objects & Events First Dynamic Page Sub btnRed _ OnClick () document.bgcolor = "red" End Sub Sub btnRed _ OnMouseOver () btnRed.Value = "RED" End Sub Sub btnRed _ OnMouseOut () btnRed.Value = "Red" End Sub Object Events

Mark Dixon, SoCCE SOFT 131Page 13 Instructions First Dynamic Page Sub btnRed_OnClick() document.bgcolor = "red" End Sub Sub btnRed_OnMouseOver() btnRed.Value = "RED" End Sub Sub btnRed_OnMouseOut() btnRed.Value = "Red" End Sub Assignment: Object.Property = Literal btnRed.Value = “Red”

Mark Dixon, SoCCE SOFT 131Page 14 Client-side Object Model window object – properties include: –.status: get/set status bar window.status = “Hello” –.close: close current window window.close –.SetInterval: allow timed actions document object – properties include: –.title: get/set title of page –.write: write text to page –.bgColor: get/set background colour of page –.location: get/set current location of browser

Mark Dixon, SoCCE SOFT 131Page 15 Example: Puppy Puppy's web page Sub btnGuest_OnClick() document.title = "Puppy (large image)" picFace.src = "FaceLarge.jpg" End Sub Welcome, Puppy's web page.

Mark Dixon, SoCCE SOFT 131Page 16 Example: Puppy (code) Puppy's web page Sub btnGuest_OnClick() document.title = "Puppy (large image)" picFace.src = "FaceLarge.jpg" End Sub Welcome, Puppy's web page. Script ignored, until button pressed picture and button, given identifiers

Mark Dixon, SoCCE SOFT 131Page 17 Example: Ball Character (design) Trigger (when)Actions (what) click event of Right buttonmove ball character right click event of Left buttonmove ball character left click event of Up buttonmove ball character up click event of Down buttonmove ball character down

Mark Dixon, SoCCE SOFT 131Page 18 Example: Ball Character (script) Test Sub btnRight_OnClick () picBall.hspace = picBall.hspace + 10 End Sub Sub btnDown_OnClick () picBall.vspace = picBall.vspace + 10 End Sub

Mark Dixon, SoCCE SOFT 131Page 19 Example: Garden Wildlife

Mark Dixon, SoCCE SOFT 131Page 20 Debugging: Testing Functional Decomposition –break it into logical chunks Incremental Development –type a bit –test it Testing –test all/most combinations Regression Testing –repeat all previous tests

Mark Dixon, SoCCE SOFT 131Page 21 Tutorial Exercise: Colour Change LEARNING OBJECTIVE: to understand objects, events, properties, and event handler procedures, so that you can create dynamic content in your web-pages TASK 1: Get the Red button from the Colour Change example working. (the code is provided) TASK 2: Get the Blue button working. (You will need to work out what code to use. Use the code provided as inspiration) TASK 3: Add another button (you choose the colour).

Mark Dixon, SoCCE SOFT 131Page 22 Tutorial Exercise: Puppy LEARNING OBJECTIVE: to understand objects, events, properties, and event handler procedures, so that you can create dynamic content in your web-pages TASK 1: Get the Puppy example working. (code provided, images in resources area on server). TASK 2: Add a button, which changes the image back to the smaller picture.

Mark Dixon, SoCCE SOFT 131Page 23 Tutorial Exercise: Ball Char LEARNING OBJECTIVE: to understand objects, events, properties, and event handler procedures, so that you can create dynamic content in your web-pages TASK 1: Get the Right and Down buttons from the Ball Character example working. (code provided, images in resources area on server). TASK 2: Get the Left and Up buttons working. (You will need to work out what code to use. Use the code provided as inspiration)

Mark Dixon, SoCCE SOFT 131Page 24 Tutorial Exercise: Garden LEARNING OBJECTIVE: to understand objects, events, properties, and event handler procedures, so that you can create dynamic content in your web-pages TASK 1: Get the Garden Animals example working. Moving the mouse over an image should change the document (page) background colour to something suitable for the animal (e.g. ladybird – red), and display the name of the animal below the images. (no code provided, but images in resources area on server)