当点击我的按钮,没有任何反应。
When my button is clicked, nothing happens.
<button onclick="captureVideo();">Capture Video</button>我已经把PhoneGap的-1.4.1.js在WWW文件夹中。
I've put phonegap-1.4.1.js in the WWW folder.
我已经包括&LT; SCRIPT SRC =JavaScript的/ PhoneGap的-1.4.1.js类型=文/ JavaScript的&GT;&LT; / SCRIPT&GT; 在我的脑海部分。
I've included <script src="javascript/phonegap-1.4.1.js" type="text/javascript"></script> in my head section.
我做了所有的配套功能,按照PhoneGap的API文档的例子。
I did all the supporting functions, as per Phonegap API Docs' example.
<script> // Called when capture operation is finished // function captureSuccess(mediaFiles) { var i, len; for (i = 0, len = mediaFiles.length; i < len; i += 1) { uploadFile(mediaFiles[i]); } } // Called if something bad happens. // function captureError(error) { var msg = 'An error occurred during capture: ' + error.code; navigator.notification.alert(msg, null, 'Uh oh!'); } // A button will call this function // function captureVideo() { // Launch device video recording application, // allowing user to capture up to 2 video clips navigator.device.capture.captureVideo(); } </script>我的其他调用其他外部JS都做工精细。只是PhoneGap的-1.4.1.js不工作。缺少什么我在这里?
My other calls to other external js all work fine. Just phonegap-1.4.1.js isn't working. What am I missing here?
修改
当我粘贴了PhoneGap的JS在线,然后我所有的这些函数的调用正常工作。所以,我确定,问题就永远不会从外部加载。 Diviceready警报会告诉我同样的事情。不过,这并不使其加载。所以,问题仍然存在,我怎么能得到外部JS加载?
When I pasted the phonegap js inline, then all my calls to those functions worked fine. So, I've established that the problem was it never loaded from externally. Diviceready alerts will tell me the same thing. But it doesn't MAKE it load. So, the question remains, how can I get the external js to load?
推荐答案该文件是在这里:
我已经把PhoneGap的-1.4.1.js在WWW文件夹中。
I've put phonegap-1.4.1.js in the WWW folder.
但你包括它在不同的位置:
But you're including it in a different location:
我已经包括&LT; SCRIPT SRC =JavaScript的/ PhoneGap的-1.4.1.js类型=文/ JavaScript的&GT;&LT; / SCRIPT&GT; 在我的脑海部分。
I've included <script src="javascript/phonegap-1.4.1.js" type="text/javascript"></script> in my head section.
它不加载,因为它希望找到一个javascript目录下的文件,而你把它放在www文件夹。使www文件夹内的目录的JavaScript,或者从你的脚本标记的SRC删除的JavaScript。
It's not loading because it expects to find the file inside a javascript directory, while you've put it in the www folder. Make a dir "javascript" inside the www folder, or remove "javascript" from the src in your script tag.
更多推荐
调用phonegap.js将无法正常工作
发布评论