swe 444 internet and web application development( javascript )

92
SWE 444 Internet and Web Application Development(javaScript) Mr.Abdullah Mrian

Upload: astin

Post on 16-Mar-2016

33 views

Category:

Documents


1 download

DESCRIPTION

SWE 444 Internet and Web Application Development( javaScript ). Mr.Abdullah Mrian. Overview A "scripting" language for HTML pages - a scripting language is a lightweight programming language. Embed code in HTML pages so they are downloaded directly to browser. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: SWE 444 Internet and Web Application Development( javaScript )

SWE 444Internet and Web Application

Development(javaScript)

Mr.Abdullah Mrian

Page 2: SWE 444 Internet and Web Application Development( javaScript )

Overview

A "scripting" language for HTML pages - a scriptinglanguage is a lightweight programming language.

Embed code in HTML pages so they are downloadeddirectly to browser.

The browser interprets and executes the script (it is not compiled).

Was designed to add interactivity to HTML pages.

Everyone can use JavaScript without purchasing a license.

Supported by all major browsers.

Page 3: SWE 444 Internet and Web Application Development( javaScript )

…Overview

Do not declare data types for variables.

Scripts can manipulate "browser objects:"HTML form elementsImagesFramesetc.

For security – cannot write to disk (when run on a client)

Page 4: SWE 444 Internet and Web Application Development( javaScript )

Abilities

Generating HTML content dynamically.

Monitoring and responding to user events.

Validate forms before submission.

Manipulate HTTP cookies.

Interact with the frames and windows of the browser.

Customize pages to suit users.

Page 5: SWE 444 Internet and Web Application Development( javaScript )

It is not Java

JavaScript is not Java, or even related to Java.The original name for JavaScript was “LiveScript”.The name was changed when Java became popular.

Statements in JavaScript resemble statements in Java,because both languages borrowed heavily from the C language.

JavaScript is seldom used to write complete “programs”.Instead, small bits of JavaScript are used to add functionality to HTML pages.JavaScript is often used in conjunction with HTML “forms”.

Page 6: SWE 444 Internet and Web Application Development( javaScript )

….It is not Java

JavaScript has some features that resemble features in Java:JavaScript has Objects and primitive data types.JavaScript has qualified names; for example: document.write("Hello World");JavaScript has Events and event handlers.Exception handling in JavaScript is almost the same as in Java.

JavaScript has some features unlike anything in Java:Variable names are untyped: the type of a variable depends on the value it is currently holding.Objects and arrays are defined in quite a different way.JavaScript has with statements and a new kind of for statement.

Page 7: SWE 444 Internet and Web Application Development( javaScript )

What is a script?

A program or sequence of instructions that is interpreted or carried out by another program.

A program embedded in an HTML document.

Scripts + HTML DHTML (dynamic HTML).

Page 8: SWE 444 Internet and Web Application Development( javaScript )

What is JavaScript?

Created by Netscape Originally called LiveWire then LiveScript

A client-side scripting language:

Client-side refers to the fact that it is executed in the client (browser) that the viewer is using. A server-side language is one that runs on the Web server : Examples: PHP, ASP.

Page 9: SWE 444 Internet and Web Application Development( javaScript )

Dynamic HTML …

Page 10: SWE 444 Internet and Web Application Development( javaScript )

Web Architecture for JavaScript

Page 11: SWE 444 Internet and Web Application Development( javaScript )

Client and Server

JavaScript can be used:On the client sideOn the server

More lightweight and reliable on clients than Java (Applets).

Useful for developing interactive interface (Dynamic HTML).

Page 12: SWE 444 Internet and Web Application Development( javaScript )

Example

JavaScript code is included within <script> tags:

Notes:The type attribute is to allow you to use other scripting languages (but JavaScript is the default).This simple code does the same thing as just putting<h1>Hello World!</h1> in the same place in the HTML document.The semicolon at the end of the JavaScript statement is optional:You need semicolons if you put two or more statements on the same line.It’s probably a good idea to keep using semicolons.

Page 13: SWE 444 Internet and Web Application Development( javaScript )

Dealing with old browsers

Some old browsers do not recognize script tags:These browsers will ignore the script tags but will display the included JavaScript.To get old browsers to ignore the whole thing, use:

The <!-- introduces an HTML comment.

To get JavaScript to ignore the HTML close comment, -->, the // starts a JavaScript comment, which extends to the end of the line.

Page 14: SWE 444 Internet and Web Application Development( javaScript )

Where to put JavaScript

Page 15: SWE 444 Internet and Web Application Development( javaScript )

The <script>…</script> tagThe code for the script is contained in the

<script>…</script> tag

<script type="text/javascript">...

</script>

Page 16: SWE 444 Internet and Web Application Development( javaScript )

Displaying text

• The document.write() method writes a string of text to the browser

<script type="text/javascript"> document.write("<h1>Hello, world!</h1>"); </script>

Page 17: SWE 444 Internet and Web Application Development( javaScript )

document.write()

document.write("<h1>Hello,world!</h1>");

Enclosed in quotes -- denotes a "string"

Ends in a semicolon

Page 18: SWE 444 Internet and Web Application Development( javaScript )

Getting User Input

• Use the prompt() function– Will display a pop-up window asking the user to

enter data• Examples:

name = prompt("What is your name?");payRate = prompt("Enter your pay rate: ");score = prompt("Please enter the score: ");

Page 19: SWE 444 Internet and Web Application Development( javaScript )

Comments in JavaScript

• Two types of comments– Single line

• Uses two forward slashes (i.e. //)– Multiple line

• Uses /* and */

Page 20: SWE 444 Internet and Web Application Development( javaScript )

Single Line Comment Example

<script type="text/javascript"> // This is my JavaScript comment document.write("<h1>Hello!</h1>"); </script>

Page 21: SWE 444 Internet and Web Application Development( javaScript )

Multiple Line Comment Example

<script type="text/javascript"> /* This is a multiple line comment. * The star at the beginning of this line is optional. * So is the star at the beginning of this line. */ document.write("<h1>Hello!</h1>"); </script>

Page 22: SWE 444 Internet and Web Application Development( javaScript )

Find the Bug!

<script type="text/javascript"> /* This is my JavaScript comment * that spans more than 1 line. * document.write("<h1>Hello!</h1>"); </script>

Page 23: SWE 444 Internet and Web Application Development( javaScript )

JavaScript Statements

<html><head><title>My Page</title></head><body><script language="JavaScript">

document.write('This is my firstJavaScript Page');

</script></body></html>

Page 24: SWE 444 Internet and Web Application Development( javaScript )

JavaScript Statements<html><head><title>My Page</title></head><body><script language= "JavaScript">

document.write('<h1>This is my firstJavaScript Page</h1>');

</script></body></html> HTML written

inside JavaScript

Page 25: SWE 444 Internet and Web Application Development( javaScript )

JavaScript Statements<html><head><title>My Page</title></head><body><p><a href="myfile.html"onMouseover="window.alert('Hello');"> My Page</a></p></body></html>

JavaScript writteninside HTML

An Event

Page 26: SWE 444 Internet and Web Application Development( javaScript )

Example Statements<script language="JavaScript">window.prompt('Enter your name:','');</script><form><input type="button" Value="Press"

onClick="window.alert('Hello');"></form>

Note quotes: " and '

Page 27: SWE 444 Internet and Web Application Development( javaScript )

Input and Output

• The input functions available are:– prompt (message, defaultvalue) takes an input

and returns it to the JavaScript program– confirm (question) asks the user to confirm an

input value and return a Boolean value• The output functions available are:

– document.write (string)– alert (string)

Page 28: SWE 444 Internet and Web Application Development( javaScript )

HTML Forms and JavaScript

• JavaScript is very good at processing user input in the web browser

• HTML <form> elements receive input

<form action="…" method="…" name="…" … > any number of form elements and plain HTML </form>

Page 29: SWE 444 Internet and Web Application Development( javaScript )

HTML Form Elements<input type="text"/>

<input type="password"/>

<input type="button" value="Label"/>

<input type="submit"/>

<input type="reset"/>

<input type="image" src="smiley.jpg"/>

<input type="checkbox"/>

<input type="radio" name="sex" value="Male"/>

<input type="radio" name="sex" value="Female"/><textarea rows="3" cols="40">This is the initial textspread over two lines</textarea><select> <option>First</option> <option>Second</option></select><input type="file"/>

Page 30: SWE 444 Internet and Web Application Development( javaScript )

Naming Form Elements in HTML

<form name="addressform">Name: <input name="yourname"><br />Phone: <input name="phone"><br />Email: <input name="email"><br /></form>

Page 31: SWE 444 Internet and Web Application Development( javaScript )

Forms and JavaScriptdocument.formname.elementname.value

document.addressform.yourname.valuedocument.addressform.phone.valuedocument.addressform.email.value

Page 32: SWE 444 Internet and Web Application Development( javaScript )

Using Form Data

Personalising an alert box

<form name="alertform">Enter your name:<input type="text" name="yourname"><input type="button" value= "Go"

onClick="window.alert('Hello ' + document.alertform.yourname.value);">

</form>

Page 33: SWE 444 Internet and Web Application Development( javaScript )

<html> <body><form> <input type=button name=btn1 value="Click A"

onClick="alert('button A was clicked');" > <input type=button name=btn2 value="Click B"

onClick="alert('button B was clicked');" > </form> </body> </html>

Page 34: SWE 444 Internet and Web Application Development( javaScript )

34

Reserved Words (Keywords) in JavaScript

abstract delete function null throwboolean do goto package throwsbreak double if private transientbyte else implement

sprotected true

case enum import public trycatch export in return typeofchar extends instanceof short varclass false int static voidconst final interface super volatilecontinue finally long switch whiledebugger float native synchronized withdefault for new this

Page 35: SWE 444 Internet and Web Application Development( javaScript )

Variables

• Variables names must begin with a letter or underscore

• Variable names are case-sensitive • Variables are untyped (they can hold values of

any type)• The word var is optional (but it’s good style to

use it)

Page 36: SWE 444 Internet and Web Application Development( javaScript )

Which Are Legal Identifiers?

AREA 3D lucky*** num45 Last-Chance #values x_yt3 pi num+ %done area_under_the_curve

Page 37: SWE 444 Internet and Web Application Development( javaScript )

Declaring Variables

• Before using a variable, you need to declare it.• The declaration statement includes the var

keyword and the name of the variable.• Examples of variable declarations:

var ball; var ball, area;var area;

Page 38: SWE 444 Internet and Web Application Development( javaScript )

More About Variables

• In JavaScript variables can hold four basic types of values– Numbers

• i.e. 40, 15.5, 700– Strings

• i.e. "Hello, World!", "Linux is cool!"– Booleans

• i.e. true, false– Null

• i.e. null

Page 39: SWE 444 Internet and Web Application Development( javaScript )

Using Variables: Initialization• Variables may be be given initial values, or initialized,

when declared. Examples:

var length = 7;

var diameter = 5.9;

var message = "Hello!";

var walletEmpty = true;

7

5.9

“Hello!”

length

diameter

message

truewalletEmpty

Page 40: SWE 444 Internet and Web Application Development( javaScript )

Using Variables: Assignment

• Uses the assignment operator =

Examples:

diameter = 5.9 ; area = length * width ;

Page 41: SWE 444 Internet and Web Application Development( javaScript )

JavaScript Arithmetic Operators

Operator Description Example Result

+ Addition x=y+2 x=7 y=5- Subtraction x=y-2 x=3 y=5* Multiplication x=y*2 x=10 y=5/ Division x=y/2 x=2.5 y=5% Modulus (division

remainder)x=y%2 x=1 y=5

++ Increment x=++y x=6 y=6x=y++ x=5 y=6

-- Decrement x=--y x=4 y=4x=y-- x=5 y=4

Given that y=5, the table below explains the arithmetic operators:

Page 42: SWE 444 Internet and Web Application Development( javaScript )

JavaScript Assignment Operators

Operator Example Same As Result

= x=y   x=5+= x+=y x=x+y x=15-= x-=y x=x-y x=5*= x*=y x=x*y x=50/= x/=y x=x/y x=2%= x%=y x=x%y x=0

Given that x=10 and y=5, the table below explains the assignment operators:

Page 43: SWE 444 Internet and Web Application Development( javaScript )

Adding Strings and Numbers

x=5+5;document.write(x);x="5"+"5";document.write(x);x=5+"5";document.write(x);x="5"+5;document.write(x);

10

55

55

55

Page 44: SWE 444 Internet and Web Application Development( javaScript )

Comparison Operators

Operator Description Example

== is equal to x==8 is false=== is exactly equal to (value and

type)x===5 is true

x==="5" is false!= is not equal x!=8 is true> is greater than x>8 is false< is less than x<8 is true

>= is greater than or equal to x>=8 is false

<= is less than or equal to x<=8 is true

Page 45: SWE 444 Internet and Web Application Development( javaScript )

Conditional Statements

• if statement • if...else statement • if...else if....else statement • switch statement

Page 46: SWE 444 Internet and Web Application Development( javaScript )

Example

var d = new Date();var time = d.getHours();if (time < 10) { document.write("Good morning!"); }else {

document.write("Good day!"); }

Page 47: SWE 444 Internet and Web Application Development( javaScript )

Gotcha! = versus ==var a = 2;if(a = 1) /* semantic (logic) error! */{ alert("a is one");}else if(a == 2){ alert("a is two");}else{ alert("a is " + a);}

Page 48: SWE 444 Internet and Web Application Development( javaScript )

Multiple Selection with if

if (day == 0 ) { alert ("Sunday") ;}if (day == 1 ) { alert ("Monday") ;}if (day == 2) { alert ("Tuesday") ;}if (day == 3) { alert ("Wednesday") ;}

Page 49: SWE 444 Internet and Web Application Development( javaScript )

Multiple Selection with if-elseif (day == 0 ) { alert ("Sunday") ;} else if (day == 1 ) { alert ("Monday") ;} else if (day == 2) { alert ("Tuesday") ;} else if (day == 3) { alert ("Wednesday") ;} else if (day == 4) { alert ("Thursday") ;}

else if (day == 5) { alert ("Friday") ;} else if (day == 6) { alert ("Saturday") ;} else { alert ("Error - invalid day.") ;}

Page 50: SWE 444 Internet and Web Application Development( javaScript )

switch Exampleswitch ( day ){

case 0: alert ("Sunday") ; break ;case 1: alert ("Monday") ; break ;case 2: alert ("Tuesday") ; break ;case 3: alert ("Wednesday") ; break ;

case 4: alert ("Thursday") ; break ;case 5: alert ("Friday") ; break ;case 6: alert ("Saturday") ; break ;default: alert ("Error -- invalid day.") ;

}

Page 51: SWE 444 Internet and Web Application Development( javaScript )

JavaScript Functions

How to Define a Function

function functionname(var1,var2,...,varX){

some code}

Page 52: SWE 444 Internet and Web Application Development( javaScript )

Sample Function Call alert is the name of a predefined function in the JavaScript language

alert("Hello World!"); this statement is is known as a function call this is a string we are passing as an argument (parameter) to the alert function

Page 53: SWE 444 Internet and Web Application Development( javaScript )

Sample Programmer-Defined Function

<head><script type="text/javascript"> function PrintMessage() { alert("A message for you:\n\nHave a nice day!"); }</script> </head><body> <script type="text/javascript">

PrintMessage();</script></body>

Function

Definition

Function Call

Page 54: SWE 444 Internet and Web Application Development( javaScript )

Screenshot of Function Example

Page 55: SWE 444 Internet and Web Application Development( javaScript )

The return Statement

<head><script type="text/javascript">

function product(a,b){ return a*b; }

</script> </head><body>

<script type="text/javascript">document.write(product(4,3));

</script> </body>

Page 56: SWE 444 Internet and Web Application Development( javaScript )

Example<html> <head><script type="text/javascript">function myFunction(){ return ("Hello world!"); }</script> </head>

<body><script type="text/javascript">document.write(myFunction())</script> </body> </html>

Page 57: SWE 444 Internet and Web Application Development( javaScript )

JavaScript Loops

<html> <body><script type="text/javascript">var i=0;for (i=0;i<=5;i++){

document.write("The number is " + i); document.write("<br />");}

</script> </body> </html>

Page 58: SWE 444 Internet and Web Application Development( javaScript )

Another Example<html>

<head> <title>computing factorials</title></head>

<body>

<h1>Looping example of javascript</h1>

<script language="javascript">

document.write("<h1>factorial table</h1>");

for ( i = 1, fact = 1; i < 10; i++) {

fact = fact * i;

document.write(i + "! = "+ fact);

document.write("<br>");

}

</script> </body> </html>

Page 59: SWE 444 Internet and Web Application Development( javaScript )

Another Example

Page 60: SWE 444 Internet and Web Application Development( javaScript )

JavaScript Loops

<html> <body><script type="text/javascript">var i=0;while (i<=5) { document.write("The number is " + i); document.write("<br />"); i++; }</script> </body> </html>

Page 61: SWE 444 Internet and Web Application Development( javaScript )

JavaScript Loops<html> <body>

<script type="text/javascript">var i=0;do { document.write("The number is " + i);

document.write("<br />"); i++;

}while (i<=5);</script> </body> </html>

Page 62: SWE 444 Internet and Web Application Development( javaScript )

for...in Statement

for...in statement loops through the properties of an object.

Syntaxfor (variable in object) { code to be executed }

Page 63: SWE 444 Internet and Web Application Development( javaScript )

JavaScript Loops

Looping through the properties of an object:Examplevar person = { fname: "John", lname: "Doe " , age:25 }; 

for (x in person){ document.write(person[x] + " ");}

Page 64: SWE 444 Internet and Web Application Development( javaScript )

Event Handlers• Special-purpose functions that come

predefined with JavaScript

• They are mostly called from the HTML part of a Web page and not the <script> … </script> part

Page 65: SWE 444 Internet and Web Application Development( javaScript )

65

Page 66: SWE 444 Internet and Web Application Development( javaScript )

<input type=“submit” name=“sendEmail” value=“Send eMail” onMouseOver= “if (document.sendEmail.sender.value.length < 1) window.alert(‘Empty From field! Please correct’)”>

Page 67: SWE 444 Internet and Web Application Development( javaScript )

JavaScript Event Handling

The event handler attribute consists of 3 parts:• The identifier of the event handler• The equal sign• A string consisting of JavaScript statements

enclosed in double or single quotes

Page 68: SWE 444 Internet and Web Application Development( javaScript )

onMouseOver=“checkForm( )”

JavaScript that goes between the <script>, </script> tags:

JavaScript included as an attribute of the “Send eMail” button:

function checkForm() { if ( document.sendEmail.sender.value.length < 1) { window.alert( “Empty From field! Please correct” ); }}

Page 69: SWE 444 Internet and Web Application Development( javaScript )

69

Page 70: SWE 444 Internet and Web Application Development( javaScript )

onClick=“vuWindow()”

JavaScript that goes between the <SCRIPT>, </SCRIPT> tags:

JavaScript included as an attribute of the “New Window” button:

function vuWindow() { window.open(“http://www.vu.edu.pk/”) ;}

Page 71: SWE 444 Internet and Web Application Development( javaScript )

Client-Side ProgrammingJavaScript

SWE444

Page 72: SWE 444 Internet and Web Application Development( javaScript )

Event Categories

• Keyboard and mouse events– onClick

• Load events– The page first appears on the screen: onLoad

• Form-related events– onFocus()

• Others– Errors, window resizing.

Page 73: SWE 444 Internet and Web Application Development( javaScript )

Events defined by JavaScriptHTML

elementsHTML tags

JavaScript defined events

Description

Link <a> clickdblClick

mouseDownmouseUp

mouseOver

Mouse is clicked on a linkMouse is double-clicked on a linkMouse button is pressedMouse button is releasedMouse is moved over a link

Image <img> loadaborterror

Image is loaded into a browserImage loading is abandonedAn error occurs during the image loading

Area <area>

mouseOvermouseOutdblClick

The mouse is moved over an image map areaThe mouse is moved from image map to outsideThe mouse is double-clicked on an image map

Form <form>

submitReset

The user submits a formThe user refreshes a form

… … … …

Page 74: SWE 444 Internet and Web Application Development( javaScript )

A Few of Event Handlers

onClickonDblClickonMouseOveronMouseDownonFocus

onBluronResetonSubmitonLoadonUnload

Page 75: SWE 444 Internet and Web Application Development( javaScript )

Event HandlersEvent Handlers Triggered when

onChange The value of the text field, textarea, or a drop down list is modified

onClick A link, an image or a form element is clicked once

onDblClick The element is double-clickedonMouseDown The user presses the mouse button

onLoad A document or an image is loadedonSubmit A user submits a formonReset The form is reset

onUnLoad The user closes a document or a frameonResize A form is resized by the user

Page 76: SWE 444 Internet and Web Application Development( javaScript )

onLoad event Handler

<html><head><title>onLoad and onUnload Event Handler Example</title></head><body onLoad=”alert(‘Welcome User’)” onUnload=”alert(‘Thanks for visiting the page’)”>Load and UnLoad event test.</body></html>

Page 77: SWE 444 Internet and Web Application Development( javaScript )

User Events, Form Example<html><head> <script language=“JavaScript">function dontClick() { alert("I told you not to click!");}</script></head><body><h1>Simple JavaScript Button</h1><form> <input type=“button" value="Don't Click Me" onClick="dontClick()"></form> </body></html>

Page 78: SWE 444 Internet and Web Application Development( javaScript )

onMouseOver and onMouseOut Event Handlers

<html><body><a href=“http://www.uoh.edu.sa” onMouseOver = “alert(‘Now mouse is over the

link’) “onMouseOut = “alert (‘Mouse has moved out’)”>A Link Page </a></body> </html>

Page 79: SWE 444 Internet and Web Application Development( javaScript )

onFocus & onBlur

• onFocus executes the specified JavaScript code when a window receives focus or when a form element receives input focus

• onBlur executes the specified JavaScript code when input focus leaves the field of a text, textarea, or a select option.

Page 80: SWE 444 Internet and Web Application Development( javaScript )
Page 81: SWE 444 Internet and Web Application Development( javaScript )

<input type="text" name="age"onBlur="checkAge( ) ">

JavaScript that goes between the <script>, </script> tags:

JavaScript included as an attribute of the input tag:

function checkAge( ) { if( parseInt( document.form1.age.value ) < 12 ) { window.alert( "Stop! You are younger than 12" ) ; }}

Page 82: SWE 444 Internet and Web Application Development( javaScript )

<html> <head> <script>function checkage() {

if( document.form1.age.value < 12) window.alert("stop! you are younger than 12" ) ;

}</script></head><body ><form name="form1" > <table border="1"> <tr> <td>age</td> <td><input type="text" name="age" onblur="checkage() "></td></tr> <tr> <td>phone number</td> <td><input type="text" name="phno"></td> </tr><tr> <td><input type="reset" value="reset"></td> <td><input type="submit" value="submit"></td></tr> </table></form></body></html>

Page 83: SWE 444 Internet and Web Application Development( javaScript )

Example

<html><head><script language="javascript"> function valid( ){

var input=document.myform.data.value; if (input<2) {

alert("please enter a value that is greater than 0"); }

} </script> </head>

Page 84: SWE 444 Internet and Web Application Development( javaScript )

<body> <h3>example of onblur event handler:</h3> try entering a value less than zero:<br> <form name="myform"> <input type="text" name="data" value="" size="10"

onblur='valid( )'> </form> </body> </html>

Page 85: SWE 444 Internet and Web Application Development( javaScript )

onClick

a JavaScript function is called when an object in – a button (regular, radio, reset and submit) is

clicked, – a link is pushed, – a checkbox is checked

Page 86: SWE 444 Internet and Web Application Development( javaScript )

<form name=myform onSubmit="alert(document.myform.rbtn[index].value)"> <br>

<input type=radio name=rbtn value="North" onClick="index=0" >North <br>

<input type=radio name=rbtn value="East" onClick="index=1" >East <br>

<input type=radio name=rbtn value="South" onClick="index=2" >South <br>

<input type=radio name=rbtn value="West" onClick="index=3" >West <br>

<input type=submit> </form>

Page 87: SWE 444 Internet and Web Application Development( javaScript )

Document Object Model (DOM)• DOM is an object-oriented model that describes how

all elements in an HTML page are arranged.• It is used to locate any object in your HTML page (an

unique address).

Page 88: SWE 444 Internet and Web Application Development( javaScript )

How the DOM works?<head><script>function toggle() { document.img.button1.src=“button_on.gif”; }</script></head><body><form name=“img”><a href=“test.html” onmouseover=“toggle()”> <img name=“button1” src=“button_off.gif”></a></body>

actionreaction

Action Event JavaScript DOM Reactionsrc=“button_off.gif” onmouseover toggle() document.img.button1 Src=“button_on.gif”

1) User moves mouse over object2) Event senses that something happened to the object3) JavaScript tells the object what to do (Even handler)4) Locates object on the web page5) Object’s image source is changed

Page 89: SWE 444 Internet and Web Application Development( javaScript )

Object Hierarchy

window

document frame location history

anchor image form link

button checkbox

select

textarea

submit

radio

reset

text

Page 90: SWE 444 Internet and Web Application Development( javaScript )
Page 91: SWE 444 Internet and Web Application Development( javaScript )
Page 92: SWE 444 Internet and Web Application Development( javaScript )