JavaScript Tutorial/Document/onclick

Материал из Web эксперт
Версия от 11:24, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Add document onclick event handler

   <source lang="javascript">

<html> <head> <title>W3C DOM Event Propagation</title> <script type="text/javascript"> function init() {

   document.onclick = docEvent; 

} function docEvent(evt) {

   alert("Document level ."); 

} </script> </head> <body onload="init()"> </body> </html></source>


document.onclick

The onClick event handler specifies what should happen when the mouse is clicked within the Document object.



   <source lang="javascript">

<head>

   <script language="JavaScript">
   
   </script>
   </head>
   <body>
    click anywhere within this document.
   </body>
   </html></source>