2012-01-02 5 views
1

私はJqueryモバイルの学習を始めました。私はこれに続いてhttp://dev.jtsage.com/jQM-SimpleDialog/demos/string.htmlです。ボタンをクリックしても何も起こりません。私が書いたコードは次のとおりです。 Jquery Mobileダイアログ

<link rel= "stylesheet" href= "http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" /> 
<script src= "http://code.jquery.com/jquery-1.5.2.min.js"></script> 
    <script src= "http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script> 
<script type="text/javascript"> 
$(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> 

が続いて体内で私が書いた:

 <p>You have entered: <span id="dialogoutput"></span></p> 
    <a href="#" id="dialoglink" data-role="button">Open Dialog</a> 

あなたは私のエラーを指していただけますか?たぶんヘッダーに?私はwebappに表示されないjavascriptでダイアログボックスを書いたのでjquery mobileを学ばなければならない。私は、JQMのSimpleDialogがjavascriptのダイアログ()の代わりになることを目指していることを読んでいます。

+0

http://jsbeautifier.org/ – Daniel

答えて

1

これは私のために正常に動作します:

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" /> 
    <link type="text/css" href="http://dev.jtsage.com/cdn/simpledialog/latest/jquery.mobile.simpledialog.min.css" rel="stylesheet" /> 
    <link type="text/css" href="http://dev.jtsage.com/jQM-DateBox/css/demos.css" rel="stylesheet" /> 
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script> 
    <script type="text/javascript" src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script> 
    <script type="text/javascript" src="http://dev.jtsage.com/jquery.mousewheel.min.js"></script> 
    <script type="text/javascript" src="http://dev.jtsage.com/cdn/simpledialog/latest/jquery.mobile.simpledialog.min.js"></script> 
</head> 
<body> 
<script type="text/javascript"> 
$(document).delegate('#simplestring', 'click', function() { 
    $(this).simpledialog({ 
     'mode': 'string', 
     'prompt': 'What do you say?', 
     'cleanOnClose': true, 
     'buttons': { 
      'OK': { 
       click: function() { 
        $('#simplestringout').text($('#simplestring').attr('data-string')); 
       } 
      }, 
      'Cancel': { 
       click: function() { 
        console.log(this); 
       }, 
       icon: "delete", 
       theme: "c" 
      } 
     } 
    }) 
}); 
</script> 
<a href="#" id="simplestring" data-role="button">Open Dialog</a> 
</body> 
</html>