Professional Documents
Culture Documents
Javascript 5
Javascript 5
Introduction
Characteristics :
Enhances functionality and appearance
Client-side scripting
Makes pages more dynamic and interactive
Program development
Program control
JavaScript
A type
to user actions
of programming language
Easy
to learn
appearance
Especially
graphics
Visual feedback
Perform
calculations
Validation of input
source
Executes
on client
Fast
Simple
Totally
different
A full programming language
Much harder!
A compiled language
Independent of the web
JavaScript Statements
<html>
<head><title>My Page</title></head>
<body>
<script language="JavaScript">
document.write('This is my first
JavaScript Page');
</script>
</body>
</html>
JavaScript Statements
<html>
<head><title>My Page</title></head>
<body>
<script language=JavaScript">
document.write('<h1>This is my first
JavaScript Page</h1>');
</script>
</body>
</html>
HTML written
inside JavaScript
JavaScript Statements
<html>
<head><title>My Page</title></head>
<body>
<p>
<a href="myfile.html">My Page</a>
<br />
<a href="myfile.html"
onMouseover="window.alert('Hello');">
My Page</A>
</p>
JavaScript written
An Event
</body>
inside HTML
</html>
<form name="addressform">
Name: <input name="yourname"><br />
Phone: <input name="phone"><br />
Email: <input name="email"><br />
</form>
<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>