1234567891011121314151617181920212223242526272829 |
- var request = new XMLHttpRequest()
-
- request.open('GET', 'json/azar.json', true)
-
- request.onload = function() {
- // begin accessing JSON data here
- var data = JSON.parse(this.response)
-
- /*var page = document.getElementById("home");
- page.addEventListener("show", function(event){
- var aleatorio = Math.floor(Math.random()*10);
- document.getElementById("Title").innerHTML = "Tab " + Math.floor(Math.random() * 10);
- document.getElementById("Content").innerHTML = "Number" + Math.floor(Math.random() * 10);
- });*/
-
- var page = document.getElementById("home");
- page.addEventListener("show", function(event){
- var aleatorio = Math.floor(Math.random()*11);
- //var azar = document.getElementById("azar");
- //var img = ons.createElement(`<img src="img/${aleatorio}.png">`);
- document.getElementById("image").innerHTML = `<img src="img/${aleatorio}.png" width="100%" height="300">`;
- document.getElementById("Title").innerHTML = data[aleatorio].Artesanias;
- document.getElementById("Content").innerHTML = data[aleatorio].Info;
- //azar.appendChild(img);
- });
-
- }
-
- request.send()
|