Client-side dynamic pages JavaScript... Javascript, VBscript Javascript: Netscape.. Applet: Advantage/disadvantage Advantages of Applet: Applets are cross platform and can run on Wind
Trang 1Chapter 6: side dynamics
Client-pages
Trang 2Client-side dynamic pages
JavaScript
Trang 3Client-side dynamic pages
executed in the client side by browser.
Trang 4Javascript, VBscript
Javascript:
Netscape
compiled languages such as C and C++
very useful for shorter programs
Vbscript
Trang 5mozila and internet explorer
access system resources on the local computer
Trang 6Applet: Advantage/disadvantage
Advantages of Applet:
Applets are cross platform and can run on Windows, Mac OS and Linux platform
Applets can work all the version of Java Plugin
Applets runs in a sandbox, so the user does not need to trust the code,
so it can work without security approval
Applets are supported by most web browsers
Applets are cached in most web browsers, so will be quick to load when returning to a web page
User can also have full access to the machine if user allows
Disadvantages of Java Applet:
Java plug-in is required to run applet
Java applet requires JVM so first time it takes significant startup time
If applet is not already cached in the machine, it will be downloaded
from internet and will take time
Its difficult to desing and build good user interface in applets
Trang 7Previously called Macromedia Flash
pages
web page components, to integrate video into web pages, and morerecently, to develop rich Internet applications
because:
Flash movies load faster and save on download time because Flash is vector based whereas HTML is not
Flash intelligently ‘caches’ it’s movies so they don’t have to be reloaded
Flash gives the user (the person viewing/using the Flash movie) a more responsive ‘rich-client’ like experience
Trang 9Javascript allows:
Ex: code to virsualise the current time
Trang 10Put Javascript into HTML
Trang 11Function call is put inside <script> … </script>
Trang 14Data type in Javascript
Basic data type
Contain basic character
Trang 15Variable in Javascript
Like a variable in other programming language
Data type is not defined at variable declaration
String
Array
Trang 17Operators, Control Structure
Same syntax as Java
Trang 18Function in Javascript
Function
Trang 19Function in Javascript
Declaration of a function with parameters
function function_name (param_1, param_2, … param_n){
Trang 21Event of closing a webpage
Mouse related event
Trang 23Call a javascript function by an event