Java Script and Dynamic HTML
Apa?Kenapa?
Four technologies/languages
XHTML
Cascading Styles Sheets (CSS)
Scripting languages
Document Object Model (DOM)
Bahasa Pemrograman Dynamic HTML
ASP = Active Server PageJSP = Java Server Page
VB.net = Visual Basic Network
PHP = Personal Home Page
Java script
dll
Java/Javascript
•JavaScript –Interpreted oleh client
–Terintegrasi dengan dokumen HTML
–Loose typing of data types
–Script hanya berfungsi pada browser
–Bekerja dengan elemen HTML
–Access browser objects and functionality
•Java
–Program dapat di kompile dan dapat dijalankan oleh client
– Dapat menggunkan apllet untuk dokumen Strong typing of data types
–Aplikasi yang dapat berdiri sendiri
–Dapat berjan seperi HTML (contoh multimedia)
–No access to browser objects or functionality
–Program dapat di kompile dan dapat dijalankan oleh client
– Dapat menggunkan apllet untuk dokumen Strong typing of data types
–Aplikasi yang dapat berdiri sendiri
–Dapat berjan seperi HTML (contoh multimedia)
–No access to browser objects or functionality
JavaScript Data and Variables
Variables van be used without declaring them.It is better, however to declare them, for example:
var name = "Fred";
var a, b, c;
var pi = 3.1415926;
You don't specify the type of the variable.
All data types are objects, but explicit construction is not always necessary.
JavaScript Expressions
JavaScript supports most of the same operators supported by Java.
For example, comparison operators include:
>, <, >=, <=, ==
Assignment operators include:
=, +=, -=, *=, /=, etc
Logical operators include:
&&, ||, !
Arithmetic operators include:
+, -, *, /, %
JavaScript Functions
•A function in JavaScript is like a static method in Java.•You use functions to store code that you will use a number of times.
•Functions may have parameters and return values but you don't specify the type of either.
More Advanced JavaScript
•Some of the more advanced techniques include:–Pull-down or pull-out menus
–Draggable objects
–More complex animations
•There are code libraries around for many of these tasks (see references)
•Typically you import a code library as follows:
<SCRIPT LANGUAGE="JavaScript” SRC="dynlayer.js">
</SCRIPT>
Java Applets
Server sideCompiled
Included in page
<APPLET CODE="classname.class" width="300" height="200"><PARAM NAME="paramname" VALUE="20"></APPLET>
<OBJECT classid="clock.class" codetype="application/java" width="300" height="200"><PARAM NAME="paramname" VALUE="20"></OBJECT>
0 komentar: