我對appMobi,HTML和JavaScript真的很陌生。我想要做的唯一事情是我有一個帶有onClick方法的按鈕,並且此方法應該執行任何操作。 我已經定義了一個腳本,我有一個按鈕,但該方法沒有被調用。有人可以告訴我爲什麼? appMobi提供的例子沒有做任何不同的事情 - 我想。 這裏是我的代碼:appMobi onClick不起作用
<head>
<!-- the line below is required for access to the appMobi JS library -->
<script type="text/javascript" charset="utf-8" src="http://localhost:58888/_appMobi/appmobi.js"></script>
<script type="text/javascript" language="javascript">
// This event handler is fired once the AppMobi libraries are ready
function onDeviceReady() {
//use AppMobi viewport to handle device resolution differences if you want
//AppMobi.display.useViewport(768,1024);
//hide splash screen now that our app is ready to run
AppMobi.device.hideSplashScreen();
}
//initial event handler to detect when appMobi is ready to roll
document.addEventListener("appMobi.device.ready",onDeviceReady,false);
function myfunction(){
AppMobi.debug.log("test");
alert("Hallo Welt");
}
</script>
<script type="text/javascript">
function myfunction(){
AppMobi.debug.log("test");
alert("Hallo Welt");
}
</script>
</head>
<body >
<br>
<button onclick="myfunction();">MyButton</button>
</body>
沒有人有任何想法嗎? :/ – chris13