求教

UtopianPuppy 2017-12-15 09:51:46
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Login</title>
<link type="text/css" rel="stylesheet" href="css/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="css/homepage.css" />
<script rel="script" src="js/hpgscript.js"></script>
<script src="js/bootstrap.min.js" rel="script"></script>
<script rel="script" src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script rel="script" src="http://static.runoob.com/assets/jquery-validation-1.14.0/lib/jquery.js"></script>
<script rel="script" src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
<body>
<div id="bk_color">
<!--<embed class="bgm" src="高梨康治%20-%20仪礼.mp3"></embed>-->
<p class="h1 myH1">
Present situation and Countermeasures of information technology application in Universities<br>
<small>This is a password protected page.</small>
</p>
<form id="pw_in" role="form" class="container" method="get">
<div class="input_center">
<label class="text-info" style="font-size: 18px">Password:</label>
<div class="input-group">
<span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>
<input id="password" type="password" name="password" class="form-control input-lg" style="width: 400px" placeholder="Please enter the password...">
</div><br>
<input onclick="checkPWD()" class="btn btn-info btn-lg" type="submit" value="submit" />
<button type="button" class="btn btn-link btn-info" data-toggle="tooltip" data-placement="right" title="pwd:123456">Forgot?</button>
</div>
</form>
<img src="ul0832-1893.jpg" />
</div>
</body>
</html>

function checkPWD() {
var pwd=123456;
var inpwd=document.getElementById("password").value;
if(pwd == inpwd){
window.location.href="../catalog"
}
else {
alert("Wrong password!");
}
}
下面(贼鸡儿简单的)密码js方法是html文件中引用的自定义hpgscript.js中的,
问题就是,如果单独把表单跟这个方法放在一起就可以实现效果,但当像以上这样引用时就整死不能跳转页面...求解
...全文
135 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
强长黑粗硬 2017-12-16
  • 打赏
  • 举报
回复
是不是引用的文件里有重名方法什么的啊? 在你的方法里alert看看,是不是执行到你的方法了? 别是有报错都没执行到表单提交这部分。

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧