我对javascript很新,并试图列出失败密码中缺少的字符,告诉用户他们需要输入什么。
window.onload = function()
{
var info = document.getElementById("info");
var test = document.getElementById("myForm").test;
test.onclick = function(e)
{
e.preventDefault();
var pw = document.getElementById("myForm").pw.value;
var formula = /(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9]).{6,}/;
if(formula.test(pw))
{
document.getElementById("myForm").submit();
}
else if pw.match(/\d/g) == null {
info.innerHTML = "You need a number";
console.log(pw.match(/\d/g))
} else {
info.innerHTML = "You need a number."
}
};
};
以上只是第一次检查用户是否输入了带有现在号码的密码。但我一直在
Uncaught SyntaxError: Unexpected identifier
在chrome dev工具中,pw.match部分带下划线。我在网上看过其他地方,我的语法看起来很正确。我哪里错了?
答案 0 :(得分:3)
你需要一些括号
$recordsTotal = User::whereHas('employee', function ($q) use ($company_id) {
$q->where('company_id', $company_id);
})->count();
答案 1 :(得分:2)
您需要围绕 else if (pw.match(/\d/g) == null) {
...
阻止条件的括号。
from turtle import Turtle, Screen
from random import choice, randrange
LENGTH = 200
LIMIT = 10
DELTA = 16
colors = ["blue", "orange", "cyan", "green", "purple", "black", "red", "magenta"]
def turtle_spiral(turtle, length, delta, limit):
if length < limit:
return
extent = 360 / delta
for radius in range(delta):
turtle.circle(length - radius, extent=extent)
if randrange(delta) == 0:
turtle.color(choice(colors))
turtle_spiral(turtle, length - delta, delta, limit)
yertle = Turtle(shape="turtle", visible=False)
yertle.speed("fastest")
yertle.penup()
yertle.sety(-LENGTH)
yertle.pendown()
yertle.showturtle()
turtle_spiral(yertle, LENGTH, DELTA, LIMIT)
screen = Screen()
screen.exitonclick()
答案 2 :(得分:0)
根据: http://www.w3schools.com/js/js_if_else.asp 你错过了(和)if if。