R
Russho
Gamma
¡Usuario con pocos negocios! ¡Utiliza siempre saldo de Forobeta!
enlace[0] = '<a href="URLdelenlace"><img src="URLdelaimagen"/></a>';
<a href="dirección del sitio web para el enlace">
<img src="dirección del sitio web para la imagen" />
</a>
<div id="img">
<a href="http://www.wikipwedia.com" target="_blank">
<img src="http://img3.wikia.nocookie.net/__cb20111223194956/beybladevocaloidswarriorsrp/images/5/5b/Vocaloid_rin_len_anime_display-300x300.gif" alt="">
</a>
</div>
var images = new Array();
var cont = 0;
images[0] = {
img: 'http://img2.wikia.nocookie.net/__cb20131207090002/ttff/images/0/01/Anime-girl-gun-300x300.png',
url: 'http://www.google.com'
}
images[1] = {
img: 'http://oi47.tinypic.com/2196ff7.jpg',
url: 'http://www.forobeta.com'
}
images[2] = {
img: 'http://wanabrar.com/blog/wp-content/uploads/2012/08/29028310-300x300.jpg',
url: 'http://www.facebook.com'
}
images[3] = {
img: 'http://huashequ.com.cn/wp-content/uploads/2013/06/6f061d950a7b0208959b39f063d9f2d3572cc855-300x300.gif',
url: 'http://www.twitter.com'
}
images[4] = {
img: 'http://i.imgur.com/ClujG.gif',
url: 'http://www.youtube.com'
}
function presImagen() {
var imgd = document.getElementById('img');
while (imgd.firstChild) {
imgd.removeChild(imgd.firstChild);
}
imgd.appendChild(createCode());
if (cont < images.length-1) cont ++;
else cont = 0;
tiempo = window.setTimeout('presImagen()',1000)
}
function createCode() {
var a = document.createElement('a');
a.href = images[cont].url;
a.target = '_blank';
var img = document.createElement('img');
img.src = images[cont].img;
a.appendChild(img);
return a;
}
window.onload = function() {
presImagen();
}
HTML:
PHP:<div id="img"> <a rel="nofollow" href="http://www.wikipwedia.com" target="_blank"> <img src="http://img3.wikia.nocookie.net/__cb20111223194956/beybladevocaloidswarriorsrp/images/5/5b/Vocaloid_rin_len_anime_display-300x300.gif" alt=""> </a> </div>
JS:
PHP:var images = new Array(); var cont = 0; images[0] = { img: 'http://img2.wikia.nocookie.net/__cb20131207090002/ttff/images/0/01/Anime-girl-gun-300x300.png', url: 'http://www.google.com' } images[1] = { img: 'http://oi47.tinypic.com/2196ff7.jpg', url: 'http://www.forobeta.com' } images[2] = { img: 'http://wanabrar.com/blog/wp-content/uploads/2012/08/29028310-300x300.jpg', url: 'http://www.facebook.com' } images[3] = { img: 'http://huashequ.com.cn/wp-content/uploads/2013/06/6f061d950a7b0208959b39f063d9f2d3572cc855-300x300.gif', url: 'http://www.twitter.com' } images[4] = { img: 'http://i.imgur.com/ClujG.gif', url: 'http://www.youtube.com' } function presImagen() { var imgd = document.getElementById('img'); while (imgd.firstChild) { imgd.removeChild(imgd.firstChild); } imgd.appendChild(createCode()); if (cont < images.length-1) cont ++; else cont = 0; tiempo = window.setTimeout('presImagen()',1000) } function createCode() { var a = document.createElement('a'); a.href = images[cont].url; a.target = '_blank'; var img = document.createElement('img'); img.src = images[cont].img; a.appendChild(img); return a; } window.onload = function() { presImagen(); }
http://jsfiddle.net/lombervid/owr9rLcd/1/embedded/result/
Pues tienes la misma imagen en todas. 😕
Si claro, la puse como ejemplo, pero en la web cada una es distinta, y no arranca 😛8: se queda la misma 😡 .
como encerrarias tu todo el codigo para que te arrancara, eso es en lo que me pierdo no se que etiquetas ponerle para que funcione.
Utilizamos cookies y tecnologías similares para los siguientes fines:
¿Aceptas las cookies y estas tecnologías?
Utilizamos cookies y tecnologías similares para los siguientes fines:
¿Aceptas las cookies y estas tecnologías?