本文实例讲述了JavaScript使用addEventListener添加事件监听用法。分享给大家供大家参考。具体实现方法如下:
<!DOCTYPE html>
<html lang=en>
<head>
<title>This text is the title of the document</title>
[removed]
function showalert(){
alert('you clicked me!');
}
function clickme(){
var pelement=document.getElementsByTagName('p')