0

想在 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>

警报“测试”被调用,但我总是得到这个光标事件!

4

1 回答 1

0

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

像这样使用按钮:

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

你的功能应该是这样的

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

/// 你的其他代码在这里

});

在测试功能之外使用

于 2012-05-15T13:02:32.513 回答