01.
<html>
02.
<head>
03.
<title>ThaiCreate.Com Tutorial</title>
04.
</head>
05.
<body>
06.
<script language=
"javascript"
>
07.
function
fncConfirm1()
08.
{
09.
if
(confirm(
'Goto 1'
)==true)
10.
{
11.
window.location =
'page1.cgi'
;
12.
}
13.
}
14.
15.
function
fncConfirm2()
16.
{
17.
if
(confirm(
'Goto 2'
)==true)
18.
{
19.
window.location =
'page2.cgi'
;
20.
}
21.
}
22.
23.
function
fncClose()
24.
{
25.
if
(confirm(
'Close Browser'
)==true)
26.
{
27.
window.close();
28.
}
29.
}
30.
31.
function
fncSubmit()
32.
{
33.
if
(confirm(
'Submit Form'
)==true)
34.
{
35.
document.form1.submit();
36.
}
37.
}
38.
</script>
39.
<form action=
"page.cgi"
method=
"post"
name=
"form1"
>
40.
Please input <input name=
"txtName"
type=
"txt"
id=
"txtName"
><br>
41.
<input name=
"btnButton1"
type=
"button"
value=
"Goto 1"
OnClick=
"JavaScript:fncConfirm1();"
>
42.
<input name=
"btnButton2"
type=
"button"
value=
"Goto 2"
OnClick=
"JavaScript:fncConfirm2();"
>
43.
<input name=
"btnButton3"
type=
"button"
value=
"Submit Form"
OnClick=
"JavaScript:fncSubmit();"
>
44.
<input name=
"btnButton4"
type=
"button"
value=
"Close"
OnClick=
"JavaScript:fncClose();"
>
45.
46.
47.
</body>
48.
</html>