Download presentation
Presentation is loading. Please wait.
Published byEgbert Turner Modified over 8 years ago
2
Brief Look InTo JavaScript Dr. Thomas Hicks Computer Science Department Trinity University
3
JavaScript developed by Netscape version 1.2 (Netscape 4.0) Netscape considered authority Not all versions are the same David Flannigan
4
“JavaScript is a lightweight, interpreted, programming language with rudimentary object- oriented programming capbilities”. David Flannigan
5
JavaScript is syntactically similar to Java and C++! Similarities end there!
6
JavaScript is powerful because a client-side version has been embedded within some of the more recent browsers! Netscape & Internet Explorer
7
JavaScript is a case sensitive language! while (not While, WHILE, etc.) JavaScript ignores white space! (space, tab, newline between tokens)
8
JavaScript Semicolans at the end of each statement (optional if one statement to a line! A = 5; B = 6; A = 5 B = 6
9
JavaScript Comments // ------------- till the End of Line /* ------------------------------------ ------------------------------------ */
10
HTML Tag Set
11
Code JavaScript 1] document.write(‘Hello World’)! 2] multiple tags 3] Factorial solution
12
J1.html document.write ("Hello World"); JavaScript Page
13
J2.html document.write ("Hello World"); Welcome to the Web document.write ("ByeBye World");
14
J3.html document.write(' Factorial Page '); for (i=1, Fact=1; i <= 10;i +=1, Fact *= i) { document.write (i + '! = ' + Fact); document.write (' '); }
15
If JavaScript could only do simple program, such as Factorial, we would not bother with it! Power: browser & document based objects document.write()
16
Several different JavaScript objects have control over the browser! The JavaScript event handler can enable the user to control the actions and directions of the browser!
17
The FORM object is very important in JavaScript interaction! Button, Checkbox, Hidden, Radio, Reset, Select, Password, Text, Text Object, etc.
18
CGI? Traditional HTML forms were used with CGI scripts. JavaScript is more platform independent and is more practical in some cases!
19
CGI vs JS Calculator App Using CGI, the server would have to be contacted each time the user clicked a button or entered a value! YUK!
20
Cookies? A Cookie is a term coined by Netscape to represent a chunk of code that is downloaded (from the server) to the client machine. Cookies can be stored temporarily or permanently! They transmit state information, relative to the web, back and forth with the original server! Cookies can be good!
21
Cookies http://my.yahoo.com A cookie used to remember the user preferences!
22
In many cases, the combination of browser control and cookies enable JavaScript to completely replace CGI!
23
1] can not read from files 2] can not write to files 3] has no graphics support! 4] can not support networking
24
A document that contains server-side JavaScript is requested by the client! The requested document is generated and compiled, on the server, into binary form and sent to the client! (Efficiency) Has File and Database Object Types!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.