简体   繁体   中英

What HTML elements can be made clickable with javascript?

I just started learning JavaScript and one of the first pieces of codes I've come across is onclick.

The only example I've seen it being used in are form buttons for example:

<input type="button" onclick="checkName()" value="Check name" />

I'm curious as to what other html elements can be made clickable to run javascript?

It would be great if you could list every possible type, thanks!

每个元素都可以单击。

onclick can be used with the following tags:

<a> <abbr> <acronym> <address> <area> <b> <big> <blockquote> <body> <button> <caption>     <center> <cite> <code> <col> <colgroup> <dd> <del> <dfn> <dir> <div> <dl> <dt> <em> <fieldset> <form> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <i> <img> <input> <ins> <kbd> <label> <legend> <li> <link> <map> <menu> <noframes> <noscript> <object> <ol> <optgroup> <option> <p> <pre> <q> <s> <samp> <select> <small> <span> <strike> <strong> <sub> <sup> <table> <tbody> <td> <textarea> <tfoot> <th> <thead> <tr> <tt> <u> <ul> <var>

edit.. Its easier to say wich ones do not support onclick:

<base> <bdo> <br> <head> <html> <iframe> <meta> <param> <script> <style> <title>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM