Tuesday 15 July 2014

cordova - No matter what I do I can't get my Javascript files to run on PhoneGap -


This is my first posting here, so it goes here. I have done some extensive research to find the answer to my problem. I am not sure what I am doing wrong. It does not matter that I can not get my Javascript files to run on my PhoneGap application. Here's the code:

  & lt ;! DOCTYPE HTML & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Meta http-equiv = "content-type" content = "text / html; charset = UTF-8" & gt; & Lt; Title & gt; Untitled Document & lt; / Title & gt; & Lt; A href = "myapp.js" & gt; & Lt; / A & gt; & Lt; Script type = "text / javascript" src = "jquery.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "myapp.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "cordova.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "js / index.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; App.initialize (); & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Function onload () {document.addEventListener ("deviceready", onDeviceReady, false); } Function OnDevice Read () {$ (function () {$ ("body"). Append ("& lt; h1> DEVICE is ready & lt; / h1 & gt;");}); } & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body Onload = "Onload" & gt; & Lt; / Body & gt; & Lt; / Html & gt;   

The examples I was working were located here:

Here is my repository:

onload some code is run, not a function name. For this reason, you need brackets after the function name.

  & lt; Body onload = "onLoad ();" & Gt;   

In addition, while it should not be a problem, go to a element body , not in head , then you should probably remove it:

  & lt; A href = "myapp.js" & gt; & Lt; / A & gt;    

No comments:

Post a Comment