简体   繁体   English

我不明白为什么科尔多瓦链接和Javascript编码不起作用

[英]I can't understand why cordova link and Javascript coding is not working

Below is my cordova link which I've added in my HTML code but it's not working. 以下是我在我的HTML代码中添加的cordova链接,但它不起作用。

<script type="text/javascript" src="cordova.js"></script>

I've added some Javascript below but I can't understand how to apply it. 我在下面添加了一些Javascript,但我不明白如何应用它。

$(function(){
var slideIndex = 1;
showDivs(slideIndex);

function plusDivs(n) {
  showDivs(slideIndex += n);
}

function showDivs(n) {
  var i;
  var x = document.getElementsByClassName("mySlides");
  if (n > x.length) {slideIndex = 1}    
  if (n < 1) {slideIndex = x.length}
  for (i = 0; i < x.length; i++) {
     x[i].style.display = "none";  
  }
  x[slideIndex-1].style.display = "block";  
}
});

Can someone help me out please? 有人可以帮我吗?

If you are creating apache cordova app you should wait until device ready. 如果要创建apache cordova应用,则应等待设备准备就绪。 Therefore you have to use like this code block. 因此,您必须使用像这样的代码块。

Index.js Index.js

(function () {
"use strict";

document.addEventListener( 'deviceready', onDeviceReady.bind( this ), false );

function onDeviceReady() {

 alert("I'm Ready!");

 //You can call  codes here
}

})(); })();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 编码新手,我不明白为什么我的 javascript 按钮无法正常工作? - New to coding,I can't figure out why my javascript buttons are not working properly? 我不明白为什么这不起作用。 地图未加载 - I can't understand why this is not working. maps is not loaded 不明白为什么 onClick 不能在 React 中工作 - Can't understand why onClick not working in React 我不明白为什么Redirect()无法正常工作 - I don't understand why Redirect() is not working 我不明白为什么我的nodejs / javascript正则表达式无法正常工作 - I don't understand why my nodejs/javascript regex isn't working 为什么我不能为数组设置css属性。 Hangman Javascript的编码 - Why can't I set a css attribute to my array. Coding for Hangman Javascript 有人可以帮助我理解为什么此JavaScript代码不起作用以及如何解决该问题吗? - Can somebody help me understand why this JavaScript code won't work, and how I can fix it? 我不明白为什么我在 a.reduce javascript 方法之后收到这个 output - I can't understand why I'm receiving this output after a .reduce javascript method Javascript-需要帮助以了解while循环为何不起作用 - Javascript - need help to understand why the while loop isn't working 我不明白为什么我的代码不起作用有人可以检查一下吗? 我很新 (JavaScript) - i can't understand why my code doesn't work can someone please check it out? I am very new (JavaScript)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM