调用phonegap.js将无法正常工作

编程入门 行业动态 更新时间:2024-10-12 20:27:44
本文介绍了调用phonegap.js将无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当点击我的按钮,没有任何反应。

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将无法正常工作

本文发布于:2023-11-27 19:58:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1639399.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:无法正常   工作   phonegap   js

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!