2011-12-07 12 views
9

im PhoneGap yeni ve i android için PhoneGap uygulaması geliştirmek istiyor .. benim html üzerindeki düğmeye tıklandığında bazı fonksiyon vermek istiyorum .. ben bu kodu denedim ama öyle değil çalışır:Telefon hafızasında tuşa nasıl işlev eklenir?

index.html

<!DOCTYPE HTML> 
<html> 
<head> 
<title>PhoneGap</title> 
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script> 
<script type="text/javascript" charset="utf-8" src="mycode.js"></script> 
</head> 
<body onload="init();> 
    <h1>Hello World</h1> 
    <form> 
     <input type="button" value="Click me" onclick="msg()" /> 
    </form> 
</body> 
</html> 

mycode.js

function init() { 
    // the next line makes it impossible to see Contacts on the HTC Evo since it 
    // doesn't have a scroll button 
    // document.addEventListener("touchmove", preventBehavior, false); 
    document.addEventListener("deviceready", deviceInfo, true); 
} 

function msg() 
{ 
    alert("button clicked"); 
} 

kimse benim sorunu çözmek için nasıl gelmiştir ?? teşekkürler önce ..

cevap

13

Sadece gövde etiketinin

<body onload="init();"> 
+6

Bunu nefret ediyorum içinde kapanmasını "(çift tırnak) koymak :) – ToddBFisher

İlgili konular