欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JavaScript使用addEventListener添加事件監(jiān)聽用法實(shí)例

 更新時(shí)間:2015年06月01日 10:42:59   作者:秋風(fēng)秋雨  
這篇文章主要介紹了JavaScript使用addEventListener添加事件監(jiān)聽的方法,實(shí)例分析了addEventListener方法的相關(guān)使用技巧,需要的朋友可以參考下

本文實(shí)例講述了JavaScript使用addEventListener添加事件監(jiān)聽用法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

<!DOCTYPE html>
<html lang="en">
<head>
 <title>This text is the title of the document</title>
 <script>
  function showalert(){
   alert('you clicked me!');
  }
  function clickme(){
   var pelement=document.getElementsByTagName('p')[0];
   pelement.addEventListener('click', showalert, false);
  }
  window.addEventListener('load', clickme, false);
 </script>
</head>
<body>
 <div id="main">
  <p>Click Me</p>
  <p>You Can't Click Me</p>
 </div>
</body>
</html>

希望本文所述對(duì)大家的javascript程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論