JavaScript - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

JavaScript

Description:

Warn users their Web browsers do not understand JavaScript NOSCRIPT ... INPUT TYPE=button NAME=button1 Value='Don't Press!'onclick='alert( Don't Press Me' ... – PowerPoint PPT presentation

Number of Views:44
Avg rating:3.0/5.0
Slides: 16
Provided by: DrC89
Category:

less

Transcript and Presenter's Notes

Title: JavaScript


1
JavaScript
Lance Cohen, Ph.D. Molloy College
2
SCRIPT tag
  • ltSCRIPT LANGUAGEJavaScriptgt
  • lt/SCRIPTgt

3
ltNOSCRIPTgt
  • Warn users their Web browsers do not understand
    JavaScript
  • ltNOSCRIPTgt
  • ltHRgtYour Web browser doesnt speak
    Javascript!ltHRgt
  • lt/NOSCRIPTgt

4
Write ltdocument.writelngt
  • Use document.writeln to print
  • document.writeln(X is x)
  • document.writeln(Count is , count)
  • document.writeln(Hello, world!)

5
For Loop
  • For (initial exp condition update exp)
  • statements
  • for(var I 0 I lt 9 I)
  • document.writeln(I)

6
IfElse
  • If (condition)
  • statements
  • else
  • statements

7
IfElse
  • If(message.IsEncrypted( ))
  • Message.Decrypt(SecretKey))
  • else
  • Message.Display( )

8
Function
  • Function name(paramater)
  • statements
  • function square(x)
  • return x x

9
Alert
  • INPUT TYPEbutton NAMEbutton1 ValueDont
    Press!onclickalert(Dont Press Me)gt
  • Users must dismiss this dialogue box
  • before going forward.

10
Confirm
confirm(Do you agree?)
  • Puts up dialog box
  • Two buttons OK and Cancel
  • Users must click on one or the other
  • Returns true or false

11
Prompt
prompt(Give me your URL, faculty.molloy.edu)
  • Provides a text box
  • Users insert text
  • Can provide a default string
  • Returns a value

12
Location
  • Location object holds the current URL
  • Control browsing from within JavaScript
  • location.hrefhttp//faculty.molloy.edu/lcohen

13
Status Bar
  • Holds value in the status bar below the main
    screen
  • window.defaultStatus"Help your reader!

14
Open a Window
  • JavaScript can create a new window automatically.
  • window.open(text.htm,New Window,width300,hei
    ght250)

15
  • Signing off
Write a Comment
User Comments (0)
About PowerShow.com