如何在点击时调用JavaScript函数?
要通过单击JavaScript中的按钮来调用函数,请使用onclick。尝试运行以下代码以在JavaScript中调用onclick函数-
示例
<html>
<head>
<script>
function sayHello() {
document.write ("你好!");
}
</script>
</head>
<body>
<p>Click the following button to call the function</p>
<form>
<input type = "button" onclick = "sayHello()" value = "Say Hello">
</form>
<p>Use different text in write method and then try...</p>
</body>
</html>热门推荐
3 入学校简短祝福语
10 双节祝福语简短英文
11 生日祝福语男兄弟简短
12 学生祝福语简短古诗句
13 春节送祝福语简短的
14 保持快乐祝福语大全简短
15 孙媳妇祝福语简短
16 18岁的祝福语简短
17 新婚红包祝福语简短男
18 住学长学姐祝福语简短