Jquery 未捕获类型错误:无法读取属性';短信和x27;未定义的

Jquery 未捕获类型错误:无法读取属性';短信和x27;未定义的,jquery,cordova,Jquery,Cordova,我正在尝试编写用于在phonegap中发送sms的代码。我已编写了代码。但我收到错误:Uncaught TypeError:无法读取未定义的属性“sms”。以下是我的代码。 请告知 <!DOCTYPE html> <html> <head> <meta name="viewport" content= "width=device-width; height=device-height; user-scalable=no">

我正在尝试编写用于在phonegap中发送sms的代码。我已编写了代码。但我收到错误:Uncaught TypeError:无法读取未定义的属性“sms”。以下是我的代码。 请告知

<!DOCTYPE html>
<html>
    <head>
    <meta name="viewport" content= "width=device-width; height=device-height; user-scalable=no">
        <link rel="stylesheet" type="text/css" href= "jquery.mobile-1.0b3.min.css"> 
        <script src="jquery-1.6.min.js" type= "text/javascript"></script>
        <script src="jquery.mobile-1.0b3.min.js" type="text/javascript"> </script>
        <script src="cordova-2.3.0.js" type="text/javascript"> </script>
        <Script src="smsplugin.js" type="text/javascript" ></script>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>  
</head>
<script type="text/javascript">
//document.addEventListener("deviceready", onDeviceReady, false);
//function onDeviceReady () {

function Message() {
alert("hi");
alert('Phone: ' + $('#phone').val() + ' Message: ' + $('#message').val());
window.plugins.sms.send($('#phone').val(), 
    $('#message').val(), 
    function () { 
       alert('Message sent successfully');  
    },
    function (e) {
        alert('Message Failed:' + e);
    }
);
}

</script>
<body>
<div id="startPage" data-role="page" data-theme="a">
<a href="home.html" data-role="button" data-transition="turn" data-inline="true" data-icon="back">Back</a>
<div data-role="header">
<h1>SMS Demo</h1>
</div>
<div data-role="content">
<label for="phone">Recipient Number:</label>
<input type="tel" id="phone" name="phone" placeholder="SMS Number"/>
<label for="message">Message:</label>
<textarea id="message" name="message" placeholder="Type your text message here...........(Eg- Hi Dad, I am in an emergency...please help me.I am located at (GPS Location))"></textarea>    
<!--<a href="#" id="sms" data-role="button"  onclick="Message()">Send</a></br>-->
  <button id= "sendbutton" onClick="Message()">Send</button>
</div>
</div>
</body>
</html>

//文件。添加的监听器(“deviceready”,OnDeviceraddy,false);
//函数ondevicerady(){
函数消息(){
警报(“hi”);
警报('Phone:'+$('#Phone').val()+'消息:'+$('#消息').val());
window.plugins.sms.send($('#phone').val(),
$('#message').val(),
函数(){
警报(“消息已成功发送”);
},
职能(e){
警报(“消息失败:”+e);
}
);
}
短信演示
收件人号码:
信息:
发送

取消对deviceready事件侦听器的注释,并调用onDeviceReady函数中的消息

请参阅插件的示例代码

function onDeviceReady () {
        $('#send').bind('click', function () {
            alert('Phone: ' + $('#phone').val() + ' Message: ' + $('#message').val());
            window.plugins.sms.send($('#phone').val(), 
                $('#message').val(), 
                function () { 
                   alert('Message sent successfully');  
                },
                function (e) {
                    alert('Message Failed:' + e);
                }
            );
        });                         
    }
    document.addEventListener("deviceready", onDeviceReady, false);

我不确定这是否是问题的根源,但您包含了两个版本的jQuery