麻烦老师检查一下哪里错了
来源:2-13 编程练习
慕码人2001750
2021-05-25 12:21:35
相关代码:
<!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>
<form action="">
用户名:<input type="text" id='name' >
密码:<input type="text" id='pass' >
<button type="button" id="submit">登录</button>
</form>
<script>
var name = document.getElementById('name');
var pass = document.getElementById('pass');
var submit = document.getElementById('submit');
submit.onclick = function () {
if (name.value == '张三' && pass.value == '123456') {
window.location = 'https://www.imooc.com';
} else {
alert('信息不对');
}
}
</script>
</body>
</html>
相关截图:
1回答
好帮手慕星星
2021-05-25
同学你好,已经在另外一个相似问题中进行了回复,可以查看:
https://class.imooc.com/course/qadetail/290240
建议:提交问题遇到审核时,不要重复提交,老师们可以看到,避免重复。
祝学习愉快!
相似问题