Thursday, 16 February 2012

JavaScript vs Java

COMPARISON OF JAVASCRIPT AND JAVA

JavaScript

  • Easy to learn and use
  • Useful for simple tasks
  • Not developer's kit required
  • JavaScript code is written directly in HTML and it does not require compiling

Java

  • Complicated to learn and use
  • Useful for complex tasks
  • Requires Java developer kit to create applets
  • Java programs are saved in separate files and must be complied before they can be run

JavaScript

JAVASCRIPT

There are 6 basic of JavaScript

  • For Loop
  • While Loop
  • Do While Loop
  • User-defined Function
  • Working with Web Pages Properties
  • Error Checking

For Loop

  • Execute the same block of code according specified times.


  • Another example of Loop


While Loop
  • Execute the same block of code while a specific condition is true





  • Another example While Loop

Do While Loop

  • Execute the block of code at least once even the condition is false. because the code will be executed first before condition is tested. It will repeat the loop as long as the specified condition is true.




User-defined Function





Working with Web Page Properties

  • May be you are not realized that you have used Web Pages properties (or Document properties) a few times.
  • Example :

*document.write ( ) : to display information on the web page

  • We have others like :

*document.bgColor : Example | Source Code

*document.fgColor : Example | Source Code

*document.lastModified : Example | Source Code


Error Checking

  • Remember this example?









Tuesday, 14 February 2012

Client-Side Scripting



INTRODUCTION OF CLIENT-SIDE SCRIPTING

What is client-side scripting?
  • it is refers to computer programs on the web, that are executed at the client-side, by the user's web browser.

What client-side scripting can do?

  • Form validation
  • Display messages (eg: alert)
  • Dynamically modify current document (eg: document interface)
  • Animated images (eg: rollover, mouseover)

Introduction of JavaScript

  • JavaScript is a client-side scripting
  • Developed by Netscape
  • You can write JavaScript in 2 ways :

1. Within the same file with your HTML file, OR

2. In external file with ".js" file extension.

What is JavaScript function?

  • You can create function to perform specific task = user-defined function
  • Function can be executed:
  • Directly, OR
  • Through evevnts

function helloWorld(){

alert(“Hello World!”);

}








Sunday, 12 February 2012



Nama : Norazziela binti Abd Hadi

Tarikh Lahir : 24 September 1991

Tempat Lahir : Hospital Kluang, Johor

Adik Beradik : 5 orang

Anak ke : 2 daripada 5 orang

Nama Bapa : Abd Hadi bin Md. Said

Nama Ibu : Rosnah binti Shamsuddin

Sekolah Rendah : Sekolah Kebangsaan Seri Intan (SKSI)

Sekolah Menengah : Sekolah Menengah Kebangsaan Seri Intan (SMKSI)

Kolej 1 : Kolej Teknologi Timur (KTT)

Kolej 2 : Kolej Unikop