对于我之前的问题here,我没有收到错误消息,所以,复制粘贴jsbin.com中的代码,这里我在jsbin output中收到错误,因为“错过了空格和标签”在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>
答案 0 :(得分:0)
尝试 var SocialShare = {}; 这可能会解决您的问题