gpt4 book ai didi

javascript - phonegap javascript 警报不起作用?

转载 作者:行者123 更新时间:2023-11-29 22:07:48 24 4
gpt4 key购买 nike

我正在尝试使用 phonegap 和 eclipse 构建一个非常简单的 android 应用程序。我对 phonegap 很陌生。当我运行该应用程序时,该页面显示在模拟器中,但我的 javascript 警报功能不起作用。有人可以帮助我吗??这是我的 index.html 文件。

<!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>

最佳答案

在您的 html 页面中添加此 phonegap 版本标签。

<script src="cordova-x.x.x.js" charset="utf-8" type="text/javascript"></script>

否则,phonegap 事件将无法在您的页面上运行。

关于javascript - phonegap javascript 警报不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19976073/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com