【发布时间】:2018-04-26 08:39:25
【问题描述】:
我已经尝试了很多来让这个表单工作。早些时候只有“window.open”语句不起作用,但现在“alert”也停止工作,就像函数根本不起作用一样。
<html>
<head>
<title>
Validation
</title>
<script type="text/javascript" language="javascript">
function myfunction()
{
var a=GetElementById("log");
var b=GetElementById("pwd");
if (a=="log" && b=="pwd")
{
window.open("https://www.google.com");
}
else
{
alert("Your username or password is wrong");
}
}
</script>
</head>
<body>
<form method="post">
Name: <input type="textbox" id="log" name="log"> <br>
Password: <input type="password" id="pwd" name="pwd"> <br>
<input type="submit" value="submit" onsubmit="myfunction();">
</form>
</body>
【问题讨论】:
标签: validation onclick window.open