34 lines
808 B
HTML
34 lines
808 B
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
<title>Document</title>
|
||
|
<script>
|
||
|
function say(){
|
||
|
alert("你好")
|
||
|
}
|
||
|
|
||
|
</script>
|
||
|
</head>
|
||
|
<body>
|
||
|
<button onclick="say()">say</button>
|
||
|
<div>
|
||
|
<button class="says">say1</button>
|
||
|
</div>
|
||
|
<div>
|
||
|
<button class="say2">say2</button>
|
||
|
</div>
|
||
|
|
||
|
<script>
|
||
|
var mouse=document.getElementsByClassName('says')[0]
|
||
|
mouse.onclick=function(){
|
||
|
alert('nihao')
|
||
|
}
|
||
|
|
||
|
var mouse1=document.getElementsByClassName('say2')[0]
|
||
|
mouse1.addEventListener("click",function(){alert("hello")})
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|