Created
January 3, 2013 12:43
-
-
Save guange2015/4443186 to your computer and use it in GitHub Desktop.
js 添加网页监听
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Get a reference to the link and bind the showHide function to it | |
| toggle = document.getElementById('toggle'); | |
| if (toggle.addEventListener) { | |
| // modern browsers | |
| toggle.addEventListener('click', showHide, false); | |
| } else if (toggle.attachEvent) { | |
| // IE 8 and earlier | |
| toggle.attachEvent('onclick', showHide); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment