1 / 23

Brief Look InTo JavaScript

Brief Look InTo JavaScript. Dr. Thomas Hicks Computer Science Department Trinity University. JavaScript developed by Netscape version 1.2 (Netscape 4.0) Netscape considered authority Not all versions are the same. David Flannigan.

Download Presentation

Brief Look InTo JavaScript

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Brief Look InTo JavaScript Dr. Thomas Hicks Computer Science Department Trinity University

  2. JavaScript • developed by Netscape • version 1.2 (Netscape 4.0) • Netscape considered authority • Not all versions are the same David Flannigan

  3. “JavaScript is a lightweight, interpreted, programming language with rudimentary object-oriented programming capbilities”. David Flannigan

  4. JavaScript is syntactically similar to Java and C++! Similarities end there!

  5. JavaScript is powerful because a client-side version has been embedded within some of the more recent browsers! Netscape & Internet Explorer

  6. JavaScript is a case sensitive language! while (not While, WHILE, etc.) JavaScript ignores white space! (space, tab, newline between tokens)

  7. JavaScript Semicolans at the end of each statement (optional if one statement to a line! A = 5; B = 6; A = 5 B = 6

  8. JavaScript Comments // ------------- till the End of Line /* ------------------------------------------------------------------------ */

  9. HTML Tag Set <SCRIPT LANGUAGE = "JavaScript"> </SCRIPT>

  10. Code JavaScript 1] document.write(‘Hello World’)! 2] multiple <SCRIPT> tags 3] Factorial solution

  11. J1.html <HTML> <HEAD> <TITLE>J1.html</TITLE> </HEAD> <BODY> <SCRIPT LANGUAGE = "JavaScript"> document.write ("Hello World"); </SCRIPT> <CENTER><P><BR> <BR> <B><I><FONT COLOR="#000080"><FONT SIZE=+2>JavaScript Page </FONT></FONT></I></B></P></CENTER> </BODY> </HTML>

  12. J2.html <HTML> <HEAD> <TITLE>J2.html</TITLE> </HEAD> <BODY> <SCRIPT LANGUAGE = "JavaScript"> document.write ("Hello World"); </SCRIPT> <CENTER><P><BR><B><I><FONT COLOR="#000080"><FONT SIZE=+2> Welcome to the Web </FONT> </FONT></I></B></P></CENTER> <SCRIPT LANGUAGE = "JavaScript"> document.write ("ByeBye World"); </SCRIPT> </BODY> </HTML>

  13. J3.html <HTML> <HEAD> <TITLE>J3.html</TITLE> </HEAD> <BODY> <SCRIPT LANGUAGE = "JavaScript"> document.write('<FONT COLOR="#000080"><H1><CENTER> Factorial Page </CENTER></H1></FONT>'); for (i=1, Fact=1; i <= 10;i +=1, Fact *= i) { document.write (i + '! = ' + Fact); document.write ('<br>'); } </SCRIPT> </BODY> </HTML>

  14. If JavaScript could only do simple program, such as Factorial, we would not bother with it! Power: browser & document based objects document.write()

  15. 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!

  16. The FORM object is very important in JavaScript interaction! Button, Checkbox, Hidden, Radio, Reset, Select, Password, Text, Text Object, etc.

  17. CGI? Traditional HTML forms were used with CGI scripts. JavaScript is more platform independent and is more practical in some cases!

  18. 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!

  19. 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!

  20. Cookies http://my.yahoo.com A cookie used to remember the user preferences!

  21. JavaScript In many cases, the combination of browser control and cookies enable JavaScript to completely replace CGI!

  22. JavaScript 1] can not read from files 2] can not write to files 3] has no graphics support! 4] can not support networking

  23. Server-Side JavaScript • 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!

More Related