Javascript,Html,html中按钮点击绑定js事件简单示例
html中按钮点击绑定js事件简单示例
页面完整代码如下:
<!doctype html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>按钮点击绑定js事件简单示例</title>
</head>
<body>
<button onclick="alert('hello c1')">click1</button>
<button onclick="btnC2()">click2 </button>
<button onclick="btnC3('C3')">click3 </button>
<script>
function btnC2(){
alert('hello c2');
}
function btnC3(name){
alert('hello '+name);
}
</script>
</body>
</html>
Tag: Javascript Html