对于我之前的问题,我没有收到错误消息,所以将代码复制粘贴到 jsbin.com 中,在这里我在jsbin 输出中遇到错误,例如“遗漏的空格和制表符function fail(args) {
failCallback(args);
}
” "Uncaught SyntaxError: Unexpected token < (line 1)"
。对于这段 javascript 代码
Esocial.js
var SocialShare = function() {};
SocialShare.email = function(param, successCallback, failCallback) {
function success(args) {
successCallback(args);
}
function fail(args) {
failCallback(args);
alert('Write Some real Text please.');
}
return PhoneGap.exec(function(args) {
success(args);
}, function(args) {
fail(args);
}, 'SocialShare', 'startEmailActivity', [param]);
};
无法纠正此错误,请帮助我...
html代码
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-type" name="viewport" content="initial-scale=1.0, maximum- scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="index.css" />
<script type="text/javascript" charset="utf-8" src="cordova-2.4.0.js"></script>
<script type="text/javascript" charset="utf-8" src="social.js"></script>
<script type="text/javascript" charset="utf-8" src="Esocial.js"></script>
<script type="text/javascript" charset="utf-8">
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady()
{
window.SocialShare = new SocialShare();
console.log("in onDeviceReady");
}
function sendEmail()
{
SocialShare.Email= function(param, successCallback, failCallback) {
window.SocialShare.email({message:'Email body', subject: "Email Subject"},
function(msg) {
alert('Write Some real Text please.');
},
function(fail) {
}
);
}
}
</script>
</head>
<body onload="onLoad()">
<button onclick="sendEmail()" id="email">Email send </button>
</body>
</html>