我無法獲得調用我的javascript函數的按鈕,我開始以圈子形式運行。我在這方面並不是很有經驗,對我而言,它看起來像我見過的所有例子。Phonegap按鈕點擊事件
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>BONJA</title>
</head>
<body>
<div class="app">
<div class="wrapper">
<div class="content">
<div class="head">
<img src="res/logo/institucional.png" />
</div>
<div class="container">
<form>
<input type="button" value="Fazer Login" onclick="login()" class="button" id="loginClick" />
</form>
</div>
<div id="deviceready" class="blink">
<p class="event notConnected">Não conectado</p>
<p class="event connecting">conectando</p>
<p class="event connected">conectado</p>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="phonegap.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
app.initialize();
</script>
<script type="text/javascript">
function login() {
//initialize login
var parentElement = document.getElementByID('deviceready');
var notConnectedElement = parentElement.querySelector('.notConnected');
var connectingElement = parentElement.querySelector('.connecting');
notConnectedElement.setAttribute('style', 'display:none;');
connectingElement.setAttribute('style', 'display:block;');
alert("Hello world!");
}
</script>
</body>
進出口檢驗一切在iPhone模擬器的方式。
感謝您的幫助
你能分享完整的HTML嗎? –
...新增完整HTML – Johannes
新增答案....! –