【发布时间】:2014-01-14 17:34:51
【问题描述】:
大家好,我正在尝试使用 parse.com 和 javascript 为我的网站使用表单创建登录功能。但是,当我测试它时,我不断收到 Uncaught ReferenceError: myfunction is not defined 错误。任何帮助将不胜感激。
谢谢大家,我添加了引号,删除了 Uncaught ReferenceError: myfunction is not defined 错误。但我现在收到 Uncaught ReferenceError: $ is not defined 错误。我将如何消除此错误?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Sign Up</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, intial-scale=1.8" />
<script type="text/javascript" src="//www.parsecdn.com/js/parse-1.2.16.min.js"></script>
<script type="text/javascript">
function myfunction() {
var user = new Parse.User();
user.set("FirstName", $(#signup-upFirstName).val());
user.set("Surname", $(#signup-Surname).val());
user.set("EmailAddress", $(#signup-Confirmemailaddress).val());
user.set("Password", $(#signup-ConfirmPassword).val());
user.signUp(null, {
success: function (user) {
// Hooray! Let them use the app now.
},
error: function (user, error) {
// Show the error message somewhere and let the user try again.
alert("Error: " + error.code + " " + error.message);
}
});
};
</script>
<style type="text/css">
.auto-style1 {
width: 156px;
}
</style>
</head>
<body>
<div>
<form>
First Name: <input id="signup-FirstName" type="text" placeholder="Firstname"required="" />
Surname: <input id="signup-Surname" type="text" placeholder="Surname" required=""/>
Email Address:<input id="signup-EmailAddress" type="text" placeholder="EmailAddress" required=""/>
Confirm Email Address: <input id="signup-Confirmemailaddress" type="text" placeholder="confirmemailaddress" required =""/>
Password: <input id="signup-password" type="password" placeholder="password" required="" />
Confirm Password: <input id="signup-ConfirmPassword" type="password" placeholder="confirmpassword" required="" />
<input type="submit" onclick="myfunction();" value="Next" />
</form>
</div>
</body>
</html>
【问题讨论】:
-
你能设置一个jsfiddle.net吗?
标签: javascript jquery html forms parse-platform