Online Live Class Web Engineering: Course Name
Online Live Class Web Engineering: Course Name
Course name:
Web Engineering
Presented by
Shirin Aktar
Lecturer, Dept. of CSE
Dhaka City College
1
Chapter-4
2
JavaScript
3
Why use javascript
4
Scripting Language
All scripting languages are programming languages. The
scripting language is basically a language where
instructions are written for a run time environment.
5
Server-side script
6
Client-side script
7
Example
8
JavaScript Statement
JavaScript can be inserted into document by using the Script tag.
<html>
Tells where the JavaScript starts
<body>
<script type =“text/javascript” >
document.write(“Hello World!”);
</script> Commands for writing output to a page
</body>
Tells where the JavaScript ends
</html> 9
Places to put JavaScript code
10
Between the body tag
<html>
<body>
<script type =“text/javascript” >
document.write(“Hello World!”);
</script>
</body>
</html>
11
Internal JavaScript
<html>
<head>
<script>
………JavaScript code ……..
</script>
</head>
<body>
………code ……..
</body>
</html>
12
External JavaScript File
<html>
<head>
<script type=“text/javascript” src=“filename.js”>
</script>
</head>
<body>
</body>
</html>
13
External JavaScript File (Cont.)
</html>
JavaScript Output
15
Using document.write()
For testing purposes, it is convenient to
use document.write()
16
Using window.alert()
17
Using innerHTML
18
Using innerHTML(Cont.)
19
Using innerHTML(cont.)
20
Thank you
21