NAMEd anchors Enabling users to jump to specific points within Web documents.

Slides:



Advertisements
Similar presentations
Chapter 08: Adding Adding Interactivity Interactivity With With Behaviors Behaviors By Bill Bennett Associate Professor MSJC CIS MVC.
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Computer and Communication Fundamental Basic web programming Lecture 8 Rina Zviel-Girshin.
Style changes (contd.) When a user event happens in the context of some element, we may wish several aspect of the style to change For example, we may.
JavaScript and the DOM Les Carr COMP3001 Les Carr COMP3001.
Georgia Institute of Technology JavaScript part 2 Barb Ericson Georgia Institute of Technology May 2006.
Understand Web Page Development Software Development Fundamentals LESSON 4.1.
Multimedia and the World Wide Web HCI 201 Lecture Notes #8B.
MSc. Publishing on WWW JavaScript. What is JavaScript? A scripting language devised by Netscape Adds functionality to web pages by: Embedding code into.
20-Jun-15 JavaScript and HTML Simple Event Handling.
Capturing user input: Using HTML FORMs CS4320 got here on 27/11/2003.
Dynamic Web Pages Bert Wachsmuth. Review  Internet, IP addresses, ports, client-server, http, smtp  HTML, XHTML, XML  Style Sheets, external, internal,
Computer Science 103 Chapter 4 Advanced JavaScript.
JavaScript 101 Lesson 5: Introduction to Events. Lesson Topics Event driven programming Events and event handlers The onClick event handler for hyperlinks.
NAMEd anchors Enabling users to jump to specific points within Web documents.
JavaScript Client Side scripting. Client-side Scripts Client-side scripts, which run on the user’s workstation can be used to: Validate user inputs entered.
Web Programming Material From Greenlaw/Hepp, In-line/On-line: Fundamentals of the Internet and the World Wide Web 1 Introduction The JavaScript Programming.
UNIT 6 JAVASCRIPT EVENT HANDLERS &WEB BROWSERS DETECTION.
DHTML. What is DHTML?  DHTML is the combination of several built-in browser features in fourth generation browsers that enable a web page to be more.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
HTML Forms/Events (Instructor Lesson) The Event model HTML Forms Custom Events 1.
CNIT 133 Interactive Web Pags – JavaScript and AJAX Event and Event Handling.
JavaScript and The Document Object Model MMIS 656 Web Design Technologies Acknowledgements: 1.Notes from David Shrader, NSU GSCIS 2.Some material adapted.
HTML Forms and Scripts. Session overview What are forms? Static vs dynamic Client-side scripts –JavaScript.
Event Handlers CS101 Introduction to Computing. Learning Goals Learn about event handlers Determine how events are useful in JavaScript Discover where.
Chapter 19: Adding JavaScript
JavaScript II ECT 270 Robin Burke. Outline JavaScript review Processing Syntax Events and event handling Form validation.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
Introduction to JavaScript + More on Interactive Forms.
JSP Java Server Pages Softsmith Infotech.
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.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
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.
Introduction to Applets CS 3505 Client Side Scripting with applets.
Lesson13. JavaScript JavaScript is an interpreted language, designed to function within a web browser. It can also be used on the server.
Client Side Programming with JavaScript Why use client side programming? Web sides built on CGI programs can rapidly become overly complicated to maintain,
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Introduction to JavaScript 41 Introduction to Programming the WWW I CMSC Winter 2004 Lecture 17.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
HTML Form Widgets. Review: HTML Forms HTML forms are used to create web pages that accept user input Forms allow the user to communicate information back.
Introduction to JavaScript CS101 Introduction to Computing.
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.
Event JavaScript's interaction with HTML is handled through events that occur when the user or browser manipulates a page. When the page loads, that is.
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,
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
Project 8: Reacting to Events Essentials for Design JavaScript Level One Michael Brooks.
Basic Webpage Design Mark-up html document with images.
COS 125 DAY 20. Agenda Assignment 8 not corrected yet Assignment 9 posted  Due April 16 New course time line Discussion on Scripts 
 Scripts that execute in response to some event  User clicking on something  Script does NOT execute as part of page loading  DOM facilities like.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
7. JavaScript Events. 2 Motto: Do you think I can listen all day to such stuff? –Lewis Carroll.
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
LESSON : EVENTS AND FORM VALIDATION -JAVASCRIPT. EVENTS CLICK.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
Functions Wouldn’t it be nice to be able to bring up a new animal and paragraph without having to reload the page each time? We can! We can place the.
Introduction to.
DHTML.
JavaScript and HTML Simple Event Handling 11-May-18.
JavaScript is a programming language designed for Web pages.
Section 17.1 Section 17.2 Add an audio file using HTML
Web Development & Design Foundations with HTML5 7th Edition
JavaScript and HTML Simple Event Handling 19-Sep-18.
JavaScript Basics What is JavaScript?
JavaScript is a scripting language designed for Web pages by Netscape.
JavaScript and Ajax (JavaScript Events)
JavaScript and HTML Simple Event Handling 26-Aug-19.
JavaScript and HTML Simple Event Handling 4-Oct-19.
Presentation transcript:

NAMEd anchors Enabling users to jump to specific points within Web documents

Anchors and HREFs We have seen that, to jump from one web document to another, we specify the URL of the target document in the href attribute of the tag which is linking to the target document However, we can also use a name as the value of a href attribute This is used to jump to a point in a document

Dictionary of Computin Acronyms List of Definitions Definition of a CPU Definition of RAM Definition of ROM CPU A CPU is a central processing unit. Blah blah blah blah blah blah blah blah blah blah blah blah blah Go back to List of Definitions.

We use tags in two places: –to specify the hot-links –to specify the targets of the hot-links An tag used to specify a hot-link target uses a name attribute instead of a href Example: List of Defns … …. Go to list of defns

An element can also point to a specific point in a different document Example –In document 1: A place in the middle of Document 2 –In document 2 A place in the middle of this document

Image maps Another way to form hot-links

On the next slide, the image showing the Middle East can be used to link to other web documents

Clicking the dotted area below hot-links to a docm’nt on Turkey

Clicking the dotted area below hot-links to a docm’t on the Med

Clicking the dotted area below hot-links to a docm’nt on Egypt

#image1 {width:140; neight:200} ….

To use an img to provide hot-links, we need two things: –the img, which must have an explicitly stated width and height –a map of this img, which specifies what areas within the image are hot-links The map must have a name attribute The img must refer to the map which has this name

#image1 {width:140; neight:200} …. …

The map is delimited by and tags Between these tags, we must have a series of tags Each tag must have two attributes –a coords attribute which specifies the upper-left and lower-right corners of the area –a href attribute which specifies the document to which the area forms a hot-link

….

Map areas do not have to be rectangular

Cs 3314 got here on 8/11/2007

Dynamic Web Pages

Static Web Pages The web pages that we have created so far do not change after they are loaded by a browser -- they are static They provide only one feature that supports interactivity -- hotlinks Most hotlinks impose a lot of traffic on the Internet and impose a lot of computing load on servers

Dynamic Web Pages Static web pages are good but good is never enough in the world of Information Technology As soon as static web pages were available, the desire arose for pages which were more interactive and which reduced the load on the Internet and on web servers People wanted more intelligence in web pages

Adding intelligence to web pages To add intelligence to any computer entity, we must write a program which implements that intelligence There are two places where the programs can be executed: –on a server –on a broswer

Server-side versus Client-side Choosing between server-side and client- side programming depends on several factors: –Privacy how private do you want your program to be will the program manipulate private data? –Loading are you concerned about overloading your server are you concerned about the Internet

Server-side programming Advantages –Programs can be kept private: users only see the output that your program send to them –Data can be kept private –Data can be kept permanently Disadvantages –adds to server workload –adds to network traffic –delays response to user

Client-side programming Advantages –client computer does all the work –reduces traffic between server and client –enables faster response to user Disadvantages –users can see your program –users can see your data –programs cannot really keep permanent data because users can throw them away

Types of client-side programs Applets: –can avail of full power of general programming languages (Java is the one usually used); –can be compiled and, therefore, semi-private Scripts –written in simpler languages (Javascript, VBscript) developed specifically for the task –interpreted not compiled

Client-side programming with Javascript

Don’t be caught by the name Javascript is NOT Java History of Javascript: –Netscape were already developing a scripting language (called LiveScript, I think) when Sun proposed Java as a platform-independent general programming language –there was a bit of mutual band-wagon jumping some syntax blending change of name from LiveScript(?) to Javascript

What can Javascript programs do? Handle browser and/or user events create new browser frames and windows process forms process “cookies” interface with applet and server-side programs control multi-media objects on a web page

User-event Handling

Types of user events when the mouse button is clicked on an element; when the mouse button is double-clicked on an element; when the mouse button is pressed over an element; when the mouse button is released over an element; when the mouse is moved onto an element;

Types of user events (contd.) when the mouse is moved while over an element; when the mouse is moved away from an element; when a key is pressed and released over an element; when a key is pressed down over an element; when a key is released over an element.

Consider following web page It has two paragraphs of text While user moves mouse onto first paragraph, its font size will increase While user moves mouse away from second paragraph, its color will change to red

How did he do that? By associating two very short Javascript programs with each paragraph, each program with a different event: –First paragraph: one program executes when mouse enters box other program executes when mouse leaves box –Second paragraph: one program executes when mouse enters box other program executes when mouse leaves box

Associating programs with events Events happen to content elements So, contents elements can have attributes whose –names indicate the events we want to handle and –whose values are the Javascript programs we want to execute when these events occur

Names for events onclick, when the mouse button is clicked on an element; ondblclick, when the mouse button is double-clicked on an element; onmousedown, when the mouse button is pressed over an element; onmouseup, when the mouse button is released over an element; onmouseover, when the mouse is moved onto an element; onmousemove, when the mouse is moved while over an element; onmouseout, when the mouse is moved away from an element; onkeypress, when a key is pressed and released over an element; onkeydown, when a key is pressed down over an element; onkeyup, when a key is released over an element.

Extract from HTML specification <p onmouseover='this.style.fontSize=32' onmouseout='this.style.fontSize=14'> Whenever you place your mouse over me, my Font Size will increase to help you read me.

Analysis of extract: <p onmouseover='this.style.fontSize=32' onmouseout='this.style.fontSize=14'> Attributes are of form: someEventName=‘someJavascript’

Analysis continued onmouseover='this.style.fontSize=32' Javascript is enclosed by apostrophes Case is ESSENTIAL in Javascript this (note all lower-case) refers to the element to which the Javascript is attached this.style refers to the style for this element this.style.fontSize refers to the font-size property of the style for this element

Another extract from HTML spec <p onmouseover='this.style.color="red"' onmouseout='this.style.color="black"'> this.style.color refers to the color property of the style for this paragraph the values specified for the color must be enclosed in quotes

Full HTML specification Simple Mouse Event Some Subject or Other Whenever you place your mouse over me, my Font Size will increase to help you read me. Another Subject Whenever you place your mouse over me, my color will change to help you read me.