JavaScript Reference/Javascript Properties/event

Материал из Web эксперт
Перейти к: навигация, поиск

"event" Example

   <source lang="javascript">
   

<html> <body> <script id="myScript" for="myButton" event="onclick()">

   alert(myScript.event);

</script> <button id="myButton">Event for This Script</button> </body> </html>


     </source>
   
  


"event" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |<script> | +----------------+--------------------------------------------------------------+

     </source>
   
  


"event" Syntax and Note

   <source lang="javascript">

Note: Read and write property. Specifies the name of the event that will trigger the script.

Syntax:

document.getElementById("scriptID").event = value document.all.scriptID.event = value // IE only


     </source>