I have my core web-app code in the header right now in a tag but I want to move it to a separate file. When I do that an link it everything stops working. Basically the code first adds a listener onDeviceReady and from then on there are button click listeners, as well as acceleration event methods (this is a phonegap app).
I don’t know what I am doing wrong?
This is the code the way I have it now:
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/jquery.flot.js"></script>
<script type="text/javvscript" charset="utf-8" src="js/main.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for PhoneGap to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// PhoneGap is ready
//
function onDeviceReady() {
var startButton = document.getElementById("start");
startButton.addEventListener("click", startWatch, false);
var stopButton = document.getElementById("stop");
stopButton.addEventListener("click", stopWatch, false);
}
</script>
Have you considered spelling “javascript” correctly?