JavaScript adalah bahasa (pemograman) yang hebat, meskipun cenderung sulit untuk dipahami, akan tetapi kemampuan inti yang dimiliki oleh JavaScript sangat menarik untuk didalami. dengan Javascript anda dapat membuat aplikasi - aplikasi hebat seperti Google Maps. JavaScript telah merubah pandangan dunia terhadap internet ( Web ).
Keunggulan javascript yang juga dikenal dengan nama ECMAScript yaitu dapat berjalan di semua platform dengan browser yang mendukung JavaScript, dan hampir semua platform dan browser saat ini mendukung JavaScript. Contoh dari aplikasi yang dibangun dengan JavaScript adalah Google Maps yang dapat berjalan di atas Linux, Windows, dan Mac OS. JavaScript juga semakin dan terus berkembang, seperti pertumbuhan pustaka (library) yang memudahkan untuk menavigasi dokumen, memlilih elemen DOM, membuat animasi, menangani event dan mengembangkan aplikasi Ajax. JavaScript adalah bahasa pemograman client-side yang cross-platform (berjalan di banyak platform) dan bersifat bebas (untuk dimodifikasi dan gratis tentunya) juga diadopsi secara unversal.
The specifics of event handling (event types, handler registration, propagation, etc) are too extensive to be fully covered in this simple example. However this example cannot demonstrate catching a mouse click without delving a little into the JavaScript event system. Just keep in mind that this example will only graze the full details about JavaScript events and that if you wish to go beyond the basic capabilities described here to read more about the JavaScript event system.
'Mouse' events are a subset of the total events issued by a web browser in response to user actions. The following is a list of the the events emitted in response to a user's mouse action:
- Click - issued when a user clicks the mouse
- DblClick - issued when a user double-clicks the mouse
- MouseDown - issued when a user depresses a mouse button (the first half of a click)
- MouseUp - issued when a user releases a mouse button (the second half of a click)
- MouseOut - issued when the mouse pointer leaves the graphical bounds of the object
- MouseOver - issued when the mouse pointer enters the graphical bounds of the object
- MouseMove - issued when the mouse pointer moves while within the graphical bounds of the object
- ContextMenu - issued when the user clicks using the right mouse button
The simplest method for capturing these events, to register event handlers - using HTML - is to specify the individual events as attributes for your element. Example:
<script type="text/javascript">
function onclick_callback () {
alert ("Hello, World!");
}
</script>
<span onclick="onclick_callback();">Click Here</span>
0 Response to "javascript tutorial"
Post a Comment