JavaScript
I.
II.
kch bn cc s du
ci tin vic thit k, kip l ca Form, v v JavaScript
n b kch bn (script language) ph dng nht
c vi tt c t chu n 3.0 tr v sau.
-
-
-
-
-
-
-
Explorer.
III.
-
- Ja
-
-
- JavaScript c
ang HTML:
Th <script> c
<html>
<body>
<script type=”text/javascript”>
document.write(“Hello World!”)
</script>
</body>
</html>
xut ra n
Hello World!
<script type=”text/javascript”>
document.write
document.write(“Hello World!”)
</script>
Vit m
<html>
<body>
</script>
</body>
</html>
xut ra nHello World!
<html>
<body>
</script>
</body>
</html>
xut ra n Hello World!
y (;).
IV.
<!
nh
// >
</script>
Hai du x tt bia JavaScript .
B //<! ), b
duy hin th
V.
thi khi tr
n v t script trong trang HTML.
<html>
<head>
nh
</script>
</head>
c ti
ti pht trong nh
phn c
<html>
<head>
</head>
<body>
nh
</script>
</body>
body.
<html>
<head>
nh
</script>
</head>
<body>
nh
</script>
</body>
n mun chu trang, vi
n phi trang.
Thn bn ch cn to mt script rn m
r
ng sau: xxx.js.
<script>
b g dng thu t c
<html>
<head>
</head>
<body>
</body>
</html>
n nh n mun vi
Scripts cha mt phn head c
c gi.
<html>
<head>
function message()
{
alep cc gi vi s ki
}
</script>
</head>
</body>
</html>
xut ra nt hp c
c gi vi s ki
Thc thi mt phn body.
<html>
<head>
</head>
<body>
hin th
</script>
</body>
</html>
xut ra n hin th khi trang c load
script m
trang ch.
<html>
<head>
</head>
<body>
</script>
<p>
c gn
</p>
</body>
</html>
!
c g
Bi
I.
Bin ca mt bi
chy mt script. B tham khn mt bin b xem hoc thay
c
* Qui tn:
-
-
II.
B t bin vi t var:
var strname =
B t c:
strname =
III. G
Bn g :
Hoc:
n i c bi
tr
IV.
Khi bbin trong phm vi mn ch truy c
Khi bn ra khn b hc gn cc b. B