Presentation is loading. Please wait.

Presentation is loading. Please wait.

20-753: Fundamentals of Web Programming 1 Lecture 13: Javascript II Fundamentals of Web Programming Lecture 13: Javascript II.

Similar presentations


Presentation on theme: "20-753: Fundamentals of Web Programming 1 Lecture 13: Javascript II Fundamentals of Web Programming Lecture 13: Javascript II."— Presentation transcript:

1 20-753: Fundamentals of Web Programming 1 Lecture 13: Javascript II Fundamentals of Web Programming Lecture 13: Javascript II

2 20-753: Fundamentals of Web Programming 2 Lecture 13: Javascript II Today’s Topics Web Browser Object Hierarchy Examples

3 20-753: Fundamentals of Web Programming 3 Lecture 13: Javascript II Browser Object Hierarchy Objects provided by the web browser, accessible to JavaScript See Figure 16.1 on page 439 of Ladd, et al.

4 20-753: Fundamentals of Web Programming 4 Lecture 13: Javascript II Browser Objects window: the actual browser window (one session may have several) –document: the contents anchor, link, image, form –history: a list of previous documents –location: URL of current document

5 20-753: Fundamentals of Web Programming 5 Lecture 13: Javascript II Browser Objects form: an HTML FORM –button –checkbox, radio –text, textarea –hidden –password –select –reset, submit

6 20-753: Fundamentals of Web Programming 6 Lecture 13: Javascript II Window Object Methods alert(string) –pop up an alert dialog box close() –close the window confirm(string) –pop up a confirmation dialog box open(arguments… ) –open a new browser window

7 20-753: Fundamentals of Web Programming 7 Lecture 13: Javascript II Window Object Methods prompt(string, [default]) –pop up a dialog for user type-in (other methods documented in the text)

8 20-753: Fundamentals of Web Programming 8 Lecture 13: Javascript II Window Object Events onBlur –when focus is removed from the window onError –when an error occurs in the window onFocus –when focus is applied to the window

9 20-753: Fundamentals of Web Programming 9 Lecture 13: Javascript II Window Object Events onLoad –when the browser finishes loading onUnload –when the browser leaves the document

10 20-753: Fundamentals of Web Programming 10 Lecture 13: Javascript II Location Object Properties –href –host –path Methods –assign(string): sets ‘href’

11 20-753: Fundamentals of Web Programming 11 Lecture 13: Javascript II History Object Properties –current –length –previous, next Methods –back(), forward() –go(num) –go(string)

12 20-753: Fundamentals of Web Programming 12 Lecture 13: Javascript II Examples js_example_4.html js_example_5.html js_example_6.html


Download ppt "20-753: Fundamentals of Web Programming 1 Lecture 13: Javascript II Fundamentals of Web Programming Lecture 13: Javascript II."

Similar presentations


Ads by Google