javascript实现输入用户名密码再弹出,为什么点击button没有反应呢?请求支援!
<!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>
</head>
<body>
<p>username<input id="name"></p>
<p>password<input id="pass"></p>
<button type="button" onclick="click()">提交</button>
<script>
function click(){
var a,b;
a=document.getElementById("name").value;
b=document.getElementById("pass").value;
alert("用户名:"+a+"\n"+"密码:"+b);
}
</script>
</body>
</html>