get all elements with onclick in them?
问题 I am looking for a way to list all elements that have onclick event on a page. 回答1: Edited to answer further questions... I'm not sure exactly what you're asking, but I suspect you're looking for a way to see if there has been code attached to an element's onclick event? If so, try this: var allElements = document.getElementsByTagName('*'); for ( var i = 0; i<allElements.length; i++ ) { if ( allElements[i].className !== 'theClassNameYoureLookingFor' ) { continue; } if ( typeof allElements[i]