The JavaScript Programming Language - PowerPoint PPT Presentation

1 / 29
About This Presentation
Title:

The JavaScript Programming Language

Description:

Statements usually embedded in HTML code. Simple, interpreted programming language ... onClick and alert A HREF = 'killface.html' onClick = 'alert( Thanks for ... – PowerPoint PPT presentation

Number of Views:193
Avg rating:3.0/5.0
Slides: 30
Provided by: charlott100
Category:

less

Transcript and Presenter's Notes

Title: The JavaScript Programming Language


1
Introduction
  • The JavaScript Programming Language
  • Applets
  • The Java Programming Language
  • Web Page Counters

2
The JavaScript Programming Language
  • Introduction
  • JavaScript and HTML
  • Event Handlers
  • Sample JavaScript Code

3
The JavaScript Programming Language
Introduction
  • Client-side Scripting language
  • Not Java
  • Statements usually embedded in HTML code
  • Simple, interpreted programming language

4
The JavaScript Programming Language
Introduction
  • Common uses
  • Alert boxes
  • Color fades
  • Dynamically converts form elements
  • Information in status line
  • Verify form input

5
The JavaScript Programming Language
JavaScript and HTML
  • ltSCRIPTgtlt/SCRIPTgt
  • LANGUAGEJavaScript
  • SRC
  • program.js

6
The JavaScript Programming Language
JavaScript and HTML
  • ltSCRIPT LANGUAGE JavaScriptgt
  • lt!- - Begin hiding for browsers that cannot
    process JavaScript.
  • Include JavaScript statements here.
  • Last JavaScript statement goes here.
  • End hiding script. - -gt
  • lt/SCRIPTgt

7
JavaScript and HTML
ltHtmlgtltHeadgtltTitlegtonLoad Examplelt/Titlegt ltScript
Language JavaScriptgt lt!- - Begin hiding for
browsers that cannot support script. function
ready() document.forms0.elements0.valueLet
s go! //Stop hiding script. --gt lt/Scriptgt lt/Hea
dgt ltBody onLoad ready()gt ltFormgt ltInput Type
text Value Loadinggt lt/Formgtlt/Bodygtlt/Htmlgt
8
The JavaScript Programming Language
Event Handlers
  • onMouseOver and onMouseOut
  • onMouseOver
  • When you move mouse over item, action triggered
  • onMouseOut
  • When you move mouse out of area, action triggered

9
The JavaScript Programming Language
Event Handlers
  • onMouseOver and onMouseOut
  • ltA HREF ASSIGNMENTS/assign.html
  • onMouseOver document.images0.srcGRAPHICS/4
    ON.GIF
  • window.status Assignments
  • onMouseOut document.images0.srcGRAPHICS/4
    OFF.GIF
  • window.status gt
  • ltIMG SRC GRAPHICS/4OFF.GIF
  • WIDTH 42 HEIGHT 42 ALT
    Assignments
  • BORDER 0gt
  • lt/Agt

10
The JavaScript Programming Language
Event Handlers
  • When user mouses over image
  • Loads a new image
  • Assignments displayed in status line

11
The JavaScript Programming Language
Event Handlers
onClick and alert   ltA HREF killface.html
onClick alert(Thanks for loading
my pageKillface.)gt Killfaces Page lt/Agt
12
The JavaScript Programming Language
Event Handlers
13
Event Handlers
onChange and confirm ltHtmlgtltHeadgtltTitlegtConfirm
Boxlt/Titlegt ltScript Language JavaScriptgt funct
ion question(name) var theAnswer
confirm(Are you really name
?) lt/Scriptgtlt/Headgt ltBodygtltFormgt ltInput Type
text Value Enter your name
onChange question(value)gt lt/Formgtlt/Bodygtlt/Html
gt
14
The JavaScript Programming Language
Sample JavaScript Code
  • ltFORMgt
  •  
  • ltSTRONGgt
  • Temperature Conversion Example Using JavaScript
    ltBRgt
  • lt/STRONGgt
  •  
  • ltPgt nbsp lt/Pgt
  •  

15
The JavaScript Programming Language
Sample JavaScript Code
  • ltINPUT TYPE text
  • NAME cels
  • VALUE 0
  • SIZE 3
  • MAXLENGTH 3
  • onChange fahr.value 1.8 value 32gt
  • 176 ltSTRONGgtClt/STRONGgt
  • nbsp ltSTRONGgtequalslt/STRONGgt nbsp
  •  

16
The JavaScript Programming Language
Sample JavaScript Code
  • ltINPUT TYPE text
  • NAME fahr
  • VALUE 32
  • SIZE 3
  • MAXLENGTH 3
  • onChange cels.value (value - 32)/1.8gt
  • 176 ltSTRONGgtFlt/STRONGgt 
  • lt/FORMgt

17
The JavaScript Programming Language
Sample JavaScript Code
  • NAME fahr
  • fahr.value

18
Applets
  • Introduction
  • HTML Applet Tags
  • Java-Enabled Browsers
  • Sample Applets

19
Applets
Introduction
  • Little application
  • Primary features
  • Information is dynamic
  • Can respond to input
  • Program downloaded from Web server
  • Runs on the client

20
Applets
HTML Applet Tags
  • ltAPPLETgtlt/APPLETgt
  • Attributes
  • ALIGN ALT
  • CODE CODEBASE
  • HEIGHT HSPACE
  • NAME VSPACE
  • WIDTH

21
Applets
Java-Enabled Browsers
  • Browsers that are text-only or not Java-enabled
    ignore applet tags
  • Display messages

22
Applets
Sample Applets
  • ltAPPLET CODE HiMom.class
  • HEIGHT 75
  • WIDTH 125gt
  • ltPARAM NAME message
  • VALUE Hi Mom. How do you like my
    applet?gt
  • lt/APPLETgt

23
Applets
Sample Applets
24
The Java Programming Language
  • Introduction
  • Java and Object-Oriented Programming

25
The Java Programming Language
Introduction
  • Sun Microsystems, 1995
  • Java Virtual Machine

26
The Java Programming Language
Java and Object-Oriented Programming
  • Java supports object-oriented programming (OOP)
  • Object, Class
  • Inheritance

27
Web Page Counters
  • HTML Code for a Counter
  • Counter Usefulness
  • Counter Display Decision

28
Web Page Counters
HTML Code for a Counter
  • Absolute URL for CGI script as value of SRC
    attribute of image tag
  • Parameters passed using get METHOD

ltIMG SRC http//www.website-hit-counters.com/c
gi-bin/image.pl?URL51939-4076 ALT free
website hit countergt
29
Web Page Counters
Counter Usefulness
  • Number of hits per page
  • Advertising rates
  • Advertising for the counter company

Counter Display Decision
Some users offended by counters
Write a Comment
User Comments (0)
About PowerShow.com