Nuestro conocimiento compartido. Nuestro tesoro compartido. Wikipedia.
ShareCode
Permalink: http://www.treeweb.es/u/974/ 01/02/2011

ShareCode

1 <h1>Colección mis animales del zoo</h1>2 3 <div id="items"></div>4 5 6 7 8 <script>9 10 let data = [11 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803051_16.png","title":"ANACONDA + CRÍA GORILA y Libro Koa, la anaconda","num":51},12 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803050_16.png","title":"MAPACHE 2 + LEONA y Libro Mahpe, el mapache","num":50},13 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803049_16.png","title":"CABRA + VALLA + VALLA y Libro Bimba, la cabra","num":49},14 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803048_17.png","title":"TAPIR + CRÍA DE OVEJA y Libro Dante, el tapir","num":48},15 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803047_18.png","title":"VACA + CRÍA HIENA y Libro Perla, la vaca","num":47},16 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803046_16.png","title":"ARMADILLO + LEMUR SENTADO y Libro Tatú, el armadillo","num":46},17 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803045_16.png","title":"PANDA ROJO + TUCÁN y Libro Lala, la panda rojo","num":45},18 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803044_16.png","title":"IGUANA + CRÍA DE VACA (BECERRO) y Libro Lupita, la iguana","num":44},19 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803043_15.png","title":"OSO POLAR + VALLA + VALLA y Libro Nanuk, el oso polar","num":43},20 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803042_17.png","title":"CERDO + SEÑAL y Libro Duque, el cerdo","num":42},21 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803041_16.png","title":"OVEJA + ZORRO y Libro Jara, la oveja","num":41},22 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803_303.jpg","title":"PAVO REAL + SURICATA 3 y Libro Sundar, el pavo real","num":40},23 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803039_15.png","title":"LLAMA + VALLA + VALLA y Libro Qarwa, la llama","num":39},24 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803038_17.png","title":"PUERCO ESPÍN + VETERINARIO y Libro Pinchón, el puerco espín","num":38},25 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803037_16.png","title":"LOBO + CRÍA RINOCERONTE y Libro Singa, la loba","num":37},26 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803036_17.png","title":"CABALLO + OSEZNO POLAR y Libro Ray, el caballo","num":36},27 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803035_17.png","title":"LEÓN MARINO + CERVATILLO y Libro Zalop, el león marino","num":35},28 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803034_16.png","title":"ÑU + VALLA + VALLA y Libro Nyumbu, el ñu","num":34},29 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803033_16.png","title":"CIGÜEÑA + MAPACHE y Libro Kory, la cigüena","num":33},30 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803032_16.png","title":"TITÍ + PANDA HEMBRA y Libro Penacho, el tití","num":32},31 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803031_17.png","title":"CAMELLO + CRÍA AVESTRUZ y Libro Dovo, el camello","num":31},32 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803030_14.png","title":"LEOPARDO + CRÍA LINCE y Libro Lara, la leopardo","num":30},33 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803029_14.png","title":"CAPIBARA + NIÑA y Libro Krika, la capibara","num":29},34 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803028_14.png","title":"OSO HORMIGUERO + CRÍA TIGRE y Libro Yuru, el oso hormiguero","num":28},35 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803027_16.png","title":"RINOCERONTE + VALLA + VALLA y Libro Rocky, el rinoceronte","num":27},36 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803026_14.png","title":"AVESTRUZ + LOBEZNO y Libro Yinca, la avestruz","num":26},37 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803025_16.png","title":"LEMUR + NIÑO y Libro Maki, el lemur","num":25},38 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803024_15.png","title":"CIERVO + CRÍA ORANGUTÁN y Libro Dalvi, el ciervo","num":24},39 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803023_16.png","title":"GORILA + SEÑAL y Libro Kibubu, el gorila","num":23},40 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803022_15.png","title":"FLAMENCO + CRÍA CEBRA y Libro Shanky, la flamenco","num":22},41 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803021_14.png","title":"DRAGÓN DE KOMODO + SURICATA 2 y Libro Naga, la dragón de Komodo","num":21},42 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803020_15.png","title":"OSO PARDO + VALLA + VALLA y Libro Aklak, el oso pardo","num":20},43 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803019_14.png","title":"HIENA + CRÍA HIPOPÓTAMO y Libro Fisi, la hiena","num":19},44 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803018_17.png","title":"ORANGUTANA + PATO y Libro Mawa, la orangutana","num":18},45 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803017_17.png","title":"KOALA + CRÍA FOCA y Libro Baluk, la koala","num":17},46 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803016_16.png","title":"GACELA + CRÍA OSO PARDO y Libro Kukama, la gacela","num":16},47 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803015_16.png","title":"SURICATA + TIGRESA y Libro Matisa, la suricata","num":15},48 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803014_15.png","title":"GUACAMAYO + PANDITA y Libro Arara, el guacamayo","num":14},49 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803013_15.png","title":"HIPOPOTAMO + VALLA + VALLA y Libro Lolo, el hipopótamo","num":13},50 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803012_15.png","title":"FOCA + CRÍA DELFÍN y Libro Trota, la foca","num":12},51 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803011_15.png","title":"CEBRA + SEÑAL y Libro Sabina, la cebra","num":11},52 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803010_15.png","title":"PINGÜINO tumbado + y Libro Curu, el pingüino","num":10},53 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803009_15.png","title":"COCODRILO + VALLA + VALLA y Libro Kumbhira, la cocodrilo","num":9},54 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803008_15.png","title":"GUEPARDO + CANGURITO y Libro Duma, el guepardo","num":8},55 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803007_15.png","title":"CHIMPANCÉ + KOALITA y Libro Bongo, el chimpancé","num":7},56 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803006_15.png","title":"DELFÍN HEMBRA + PINGÜINITO y Libro Aihe, la delfín","num":6},57 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803005_15.png","title":"OSO PANDA + CRÍA CHIMPANCÉ y Libro Baihei, el panda","num":5},58 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803004_15.png","title":"CANGURO + JIRAFITA y Libro Lucy, la canguro","num":4},59 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803003_15.png","title":"TIGRE + PINGUÏNO de pie y Libro Sayan, el tigre","num":3},60 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803002_15.png","title":"JIRAFA + LEONCITO y Libro Sandy, la jirafa","num":2},61 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803_304.jpg","title":"Alfombra de juego (Zoo)","num":711},62 {"picture":"https://tienda.rba.es/media/catalog/product/cache/27a5c083cc7e6364885f9476615ec4e4/G/8/G803001_16.png","title":"LEÓN + ELEFANTITO y Libro Lumba, el león","num":1}63 ];64 65 // todo: sort data66 67 data.sort((a,b) => a.num - b.num); // b - a for reverse sort68 69 70 71 var items = document.getElementById('items');72 73 data.forEach(entry => {74 75  const div = document.createElement('div');76  div.classList.add('item');77  78  79  const img = document.createElement('img');80  img.src = entry.picture;81  div.appendChild(img);82  83  const title = document.createElement('div');84  title.textContent = entry.num + ' ' + entry.title;85  div.appendChild(title); 86  87  items.appendChild(div);88  89 });90 91 92 </script>93 94 
Enlace
El enlace para compartir es: