6. In HTML an image map is a list of coordinates relating to a
specific image, created in order to hyperlink areas of
the image to different destinations (as opposed to a
normal image link, in which the entire area of
the image links to a single destination).
7. In HTML an image map is a list of coordinates relating to a
specific image, created in order to hyperlink areas of
the image to different destinations (as opposed to a
normal image link, in which the entire area of
the image links to a single destination).
20. Script is a short piece of Program or a code.
We can add it by using <script>…</script>
In Html code.
21. • The <script> tag is used to define a client-
side script (JavaScript).
• The <script> element either contains
scripting statements, or it points to an
external script file through the src attribute.
• Common uses for JavaScript are image
manipulation, form validation,
and dynamic changes of content.
22. JavaScript != Java
JavaScript Variables :
• Variables are used to store data.
• A variable is a "container" for information you
want to store. A variable's value can change
during the script. You can refer to a variable by
name to see its value or to change its value.
• Rules for variable names:
– Variable names are case sensitive
– They must begin with a letter or the underscore
character
• strname – STRNAME (not same)
23. JavaScript Basic Examples
1) Output to a Browser Display
<html>
<head></head>
<body>
<script>
document.write("BsCs Web Engineering Class");
</script>
</body>
</html>
24. JavaScript Basic Examples
1) Output to a Browser Display
<html>
<head></head>
<body>
<script>
document.write("BsCs Web Engineering Class");
</script>
</body>
</html>
Output
25. 2) Creating a variable in JavaScript
Here variable can automatically sense the
data type .
var name_of_variable ;
Var = Is keyword for declaring a variable
; = termination Sign
26. 2) Creating a variable in JavaScript
var a=5;
var b=“Asad”;
document.write(a); is will show 5 on screen
document.write(b); is will show Asad
27. 2) Creating a variable in JavaScript
var a=5;
var b=“Asad”;
var ara= new Array(length);
ara[0]=“Asad”;
ara[1]=122;
So on…
28. 3) Operations In JavaScripts
<html><head></head><body><font size=12>
<script>
var a=5;
var b=10;
var c=a+b;
document.write(c);
</script>
</font></body></html>
29. 3) Operations In JavaScripts
<html><head></head><body><font size=12>
<script>
var a=5;
var b=10;
var c=a+b;
document.write(c);
</script>
</font></body></html>
Output
Same for other operation .
Can use increment and decrement .
30. 4) Functions in JavaScripts
<html><head>
<script>
function Asad(){document.write("Pak Pak
Pakistan")}
</script>
</head><body>
<script>Asad();</script>
</body></html>
31. 4) Functions in JavaScripts
<html><head>
<script>
function Asad(){document.write("Pak Pak
Pakistan")}
</script>
</head><body>
<script>Asad();</script>
</body></html>
Output
32. Flow Control Statements
5) If statement
<html><head></head><body><font size=12><script>
var a=5;
if(a>=5)
{
document.write("A is greater or Equal to 5");}
else
{
document.write("A is smaller then 5");
}
</script></font></body></html>
35. Dialog Boxes
• The alert dialog box
<script> alert(“Message”);</script>
• The confirm dialog box
<script> variable= confirm(“Message”);</script>
• The prompt dialog box
<script> variable=prompt(“Message”[“Default value”]);</script>
St=prompt(“Enter Name of city”,”Layyah”);
Confirm(“you entered city name :”+st);