01.
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
04.
<head>
05.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
06.
<title>Untitled Document</title>
07.
<script type=
"text/javascript"
language=
"javascript"
>
08.
function Simple_click(sender,e)
09.
{
10.
alert(
11.
}
12.
window.onload = function(){
13.
document.getElementById(
14.
/**
15.
* IE เป็น browser ที่ไม่ได้มาตรฐาน W3C เหมือนกับ Firefox หรือ google chrome
16.
* ถ้าเป็น Firefox การเรียก event onclick ใช้งานก็จะมีการส่ง parameter event ซึ่งเป็น object
17.
* แต่ IE เราต้องใช้ คำสั่่ง window.event
18.
*/
19.
var e = (!evt) ? window.event : evt;
20.
alert(
21.
// console.debug(e); // สำหรับ debug กับ firebug ของ firefox รันบน IE จะ error
22.
}
23.
24.
/*if (e.clientY < 0 && (e.clientX > ( document.documentElement.clientWidth - 5) || e.clientX < 15) ) {
25.
alert(
"ออกจากระบบ"
); // ถ้ากดปุ่มปิดจริงให้ alert ข้อความว่ากำลังปิดหน้าต่าง
26.
window.location.href =
"logout.php"
; // แล้วให้ไปยังหน้า logout เพื่อทำการตัด session ต่อไป
27.
}*/
28.
}
29.
</script>
30.
31.
</head>
32.
33.
<body>
34.
<div id=
"divX"
style=
"border: solid thin #9FF;"
>Click
Me
</div>
35.
<div id=
"divY"
style=
"border: solid thin #5599FF;"
onclick=
"Simple_click(this,event)"
>Click
Me
2</div>
36.
</body>
37.
</html>