JS复习:最简单的通过点击触发方法
Copyright Notice: This article is an original work licensed under the CC 4.0 BY-NC-ND license.
If you wish to repost this article, please include the original source link and this copyright notice.
Source link: https://v2know.com/article/923
JS复习:最简单的通过点击触发方法
没有什么特别的。
HTML部分:
<button onclick="myFunction()">点击我</button>
JavaScript部分:
<script>
function myFunction() {
alert("Hello World!");
}
</script>
其它的5种方法:
[4] JS复习:监测按钮点击事件触发方法(通过属性选择器)
[5] JS复习:监测按钮点击事件触发方法(通过后代选择器)
论外:
This article was last edited at 2023-05-10 06:36:33