onclick_eventListener 心已赠人 2022-07-15 12:58 98阅读 0赞 <html> <head> <title> onclick\_eventListener </title> <meta charset="UTF-8"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> </head> <body> <script type="text/javascript"> window.οnlοad=function()\{ var images=document.getElementsByTagName("img"); for(var i=0;i<images.length;i++)\{ var image=images\[i\]; if(image.addEventListener) \{ image.addEventListener("click",hide,false); alert("A"); \}else\{ image.attachEvent("onclick",hide); alert("B"); \} \} \}; function hide(event)\{event.target.style.visibility="hidden";\} </script> <img src="welcome.png" width="571" height="411" border="0" alt="" /> <input type="button" value="Show~Hi~" οnclick="alert('Hi')"> </body> </html>
还没有评论,来说两句吧...