javascript - 在 powerschool 中创建自定义页面
问题描述
我正在尝试在 powerschool(测试服务器)中创建一个自定义页面。我已经写了一些代码。实际上问题是脚本永远不会被触发。我在想脚本会被触发,因为密码文本框上有 keyup 事件。不确定我做得对。我是网页新手。任何人都可以帮忙吗?
<!DOCTYPE html>
<html>
<!-- start right frame -->
<head>
<title>Student Information</title>
</head>
<body>
<form id="StudentInformationForm" action="/admin/changesrecorded.white.html" method="POST">
<!-- start of content and bounding box -->
<div class="box-round">
<table border="0" cellspacing="0" cellpadding="3" class="linkDescList">
<colgroup><col><col></colgroup>
<td colspan="2"> </td>
</tr>
<tr class="headerRow">
<td colspan="2" class="bold">-Student Information</td>
</tr>
<tr class="Information">
<td>
<div>
<label>Student Email Address</label>
<input type="text" name="studentEmailAddress" />
</div>
<div>
<label>Student Password</label>
<input type="text" name="studentWebPassword" />
</div>
<div>
<label>Grade</label>
<label name="studentGrade">3<label/>
</div>
<div>
<button name="submit" type="button" disabled>Submit</button>
</div>
</td>
</tr>
</table>
</div>
</form>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
$j(function(){
$j("body").on("keyup","input[name='studentWebPassword']",function(){
var current_password = $j("input[name='studentWebPassword']").val();
var studentGrade = $j("input[name='studentGrade']").val();
var password_valid = true;
var hasNumber = /\d/;
var hasSpeacialCharacters=/^[a-zA-Z0-9- ]*$/;
if(studentGrade>=6) //for the students in Grade 3 to 6
{
//password should be of 5 characters and must contain a number
if (current_password.length<5 && current_password>8 && !hasNumber.test(current_password))
{
password_valid=false;
}
}
if (password_valid && current_password!='') {
$j("#submit").show();
}
});
});
</script>
</body>
</html><!-- end right frame -->
解决方案
推荐阅读
- javascript - React-table 中的表单
- laravel - 我们可以在 Laravel 5.6 中使用 Laravel 5.7 电子邮件验证吗?
- javascript - vue 数据在异步函数中改变
- python - 使用 os.walk 在目录中移动并执行脚本
- c - 如何识别字符串中第一个单词后的空格?
- reactjs - 即使在rest datagrid的管理员中没有数据显示时也显示标题
- java - java - 如何使用jsp文件中模型的特定列从java arrayList打印值
- java - Android 即时功能:这种方法是否存在根本缺陷?
- wordpress - 为什么 GCE 映像/实例组的执行速度比单个实例慢?
- angular - 如何使用ngModel双向绑定将一个对象的某些属性绑定到另一个对象?