2017-11-04 47 views
0

我想用JS喬達在我的HTML頁面,以下是代碼片段:的ReferenceError:LocalDateTime沒有定義

<html> 
    <head> 
     <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/js-joda/1.6.2/js-joda.js"></script> 
     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
    </head> 
    <body> 
     <button type="button" onclick="timeZoneFunction()">Show Time Zone</button> 
     <script> 
     function timeZoneFunction(){ 
      var dt = new LocalDateTime(); 
      var zdt = ZonedDateTime.now(); 
     } 
     </script> 
    </body> 
    </html> 

出於某種原因,我不斷收到錯誤的LocalDateTime或ZonedDateTime不定義。我試圖把本地JavaScript放在頭部,但沒有運氣。想不到我要去哪裏錯了。指針請...

回答

0

在函數調用之前使用命名空間JSJoda,它似乎工作...