jquery-mobile phonegap简单对话框

时间:2012-05-10 13:11:35

标签: jquery-mobile cordova jquery-ui-dialog

想在phonegap上使用jquery-mobile实现简单对话:http://dev.jtsage.com/jQM-SimpleDialog/demos/string.html

但是我的LogCat告诉我(当我按下按钮时):

  

05-10 15:02:37.960:V / webview(10536):singleCursorHandlerTouchEvent -getEditableSupport FASLE

<!DOCTYPE HTML>
<html>
<head>
    <meta name="viewport" content="width=600; user-scalable=no" />
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <title>Prototyp_V.2.0</title>
    <link rel="stylesheet" href="js/master.css" type="text/css" media="screen"   title="no title" charset="utf-8">
    <link rel="stylesheet" href="js/jquery.mobile-1.0a3.min.css" type="text/css" charset="utf-8">  
    <script type="text/javascript" charset="utf-8" src="js/main.js"></script>
    <script type="text/javascript" charset="utf-8" src="js/jquery.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="js/jquery.mobile-1.0.min.js"></script>
    <style type="text/css">
     .ui-page {
      background: #ffffff;
      }
    </style>  
</head>
<body onload="init();" id="stage" class="theme">        
<script type="text/javascript">     
  function test() {         
    alert("test");      
    $(document).delegate('#simplestring', 'click', function() {
      $(this).simpledialog({
        'mode' : 'string',
        'prompt' : 'What do you say?',
        'buttons' : {
        'OK': {
           click: function () {
             $('#dialogoutput').text($('#dialoglink').attr('data-string'));
           }
        },
        'Cancel': {
           click: function () { },
             icon: "delete",
             theme: "c"
           }
        }
      })
    })
  }
</script>   

<div data-role="page" id="id0">
    <div data-role="header" data-theme="c">
        <h1>Heading</h1>
    </div>
    <div data-role="content">  
       <div id="twitter_"><center>Dialog Box</center>   
          <p>You have entered: <span id="dialogoutput"></span></p>
          <a href="#" id="dialoglink" onClick=test(); data-role="button">Open  Dialog</a>   
       </div>               
    </div>
</body>
</html>

调用警报“test”,但我总是得到这个游标事件!

1 个答案:

答案 0 :(得分:0)

你是什么意思“光标事件”?和

使用按钮这样:

<a href="#" id="dialoglink"  data-role="button">Open  Dialog</a>

你的功能应该是这样的

$(document).delegate('#dialoglink, 'click', function() {

///您的其他代码就在这里

});

在测试功能之外使用