Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
重複の可能性: href と onclick の JavaScript 関数
から<a>、次の 2 つの方法で Javascript を呼び出すことができます。
<a>
<a href="javascript:alert('href triggered me')">Click me!!!</a>
<a href="#" onclick="alert('I was triggered by a DOM event')">Click me!!!</a>
私が見た限りでは、Web 開発者は両方の方法を同等に扱っています。両方の長所と短所は何ですか?