我正在嘗試使用phonegap和eclipse構建一個非常簡單的android應用程序。我對phonegap非常陌生。當我運行應用程序的頁面顯示在模擬器中,但我的JavaScript警報功能不工作。可以有人請幫助我?這是我的index.html文件。phonegap javascript alert不工作?
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
document.addEventListener("deviceready",onDeviceReady,false);
function onDeviceReady()
{
alert('hello');
}
</script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>Welcome To My Homepage</h1>
</div>
<div data-role="content">
<p>Hello Phonegap!!</p>
</div>
<div data-role="footer">
<h1>Footer Text</h1>
</div>
</div>
</body>
</html>
alert(「hello」);嘗試改變這個 – KOTIOS
試過。但它沒有奏效。 – md5
您在控制檯中遇到任何錯誤?您是否能夠在Chrome中的Ripple模擬器中查看該頁面?當我第一次開始並修復它時,這也是我的問題。 – Purus