0% found this document useful (0 votes)
15 views

Chương 5 - Javascript

The document discusses JavaScript events and how to use them. It explains that JavaScript events are "actions" that can be detected by JavaScript, such as when a page loads or a button is clicked. It provides examples of commonly used events like onclick, onload, onmouseover. It also shows how to assign an event handler to an HTML element using the onload and onclick attributes. Finally, it lists some common events and describes when each one occurs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Chương 5 - Javascript

The document discusses JavaScript events and how to use them. It explains that JavaScript events are "actions" that can be detected by JavaScript, such as when a page loads or a button is clicked. It provides examples of commonly used events like onclick, onload, onmouseover. It also shows how to assign an event handler to an HTML element using the onload and onclick attributes. Finally, it lists some common events and describes when each one occurs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

1

2




3

4

5

<script type="text/javascript">
Nhập code tại đây
</script>

6

<script type="text/javascript">
Nhập code tại đây
</script>

7

8

9
<html>
<head>
<script type="text/javascript">
some statements
</script>
</head>
<body>
<script type="text/javascript">
some statements
</script>
<script src=“Tên_file_script.js"></script>
</body>
</html>

10



11



12
13

14
<HTML>
<HEAD>
<SCRIPT>
var A = "12" + 7.5;
document.write(A);
</SCRIPT>
</HEAD>
</HTML>

15



16
17




18

19
20
21

➢ onClick ➢ onLoad
➢ onFocus ➢ onSubmit
➢ onChange ➢ onResize
➢ onBlur ➢ ………
➢ onMouseOver
➢ onMouseOut
➢ onMouseDown
➢ onMouseUp

22
<head>
<script language=“Javascript”>
function GreetingMessage()
{
window.alert(“Welcome to my
world”);
}
</script>
</head>

<body onload=“GreetingMessage()”>
</body>
23
Event Occurs when...
onabort a user aborts page loading
onblur a user leaves an object
onchange a user changes the value of an object
onclick a user clicks on an object
ondblclick a user double-clicks on an object
onfocus a user makes an object active
onkeydown a keyboard key is on its way down
Onkeypress a keyboard key is pressed
onkeyup a keyboard key is released

24
a page is finished loading. Note: In Netscape this
onload
event occurs during the loading of a page!
onmousedown a user presses a mouse-button
onmousemove a cursor moves on an object
onmouseover a cursor moves over an object
onmouseout a cursor moves off an object
onmouseup a user releases a mouse-button
onreset a user resets a form
onselect a user selects content on a page
onsubmit a user submits a form
onunload a user closes a page
25
26

You might also like