Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
to com esse script aki que altera as imagens, só que queria que quando trocasse a imagem, trocasse também o link que corresponderá a determinada imagem:
<script>
// (C) 2007 www.itirapinaonline.com.br
// http://www.itirapinaonline.com.br
// =======================================
// Segue as Variáveis:
// =======================================
// Tempo de Cada Foto (Mili segundos)
var slideShowSpeed = 5000
// Duração do Fade (segundos)
var crossFadeDuration = 3
var Pic = new Array()
Pic[0] = 'balada04.jpg'
Pic[1] = 'balada05.jpg'
Pic[2] = 'balada06.jpg'
var t
var j = 0
var p = Pic.length
var preLoad = new Array()
for (i = 0; i < p; i++){
preLoad[i] = new Image()
preLoad[i].src = Pic[i]
}
function runSlideShow(){
if (document.all){
document.images.SlideShow.style.filter="blendTrans(duration=2)"
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
document.images.SlideShow.filters.blendTrans.Apply()
}
document.images.SlideShow.src = preLoad[j].src
if (document.all){
document.images.SlideShow.filters.blendTrans.Play()
}
j = j + 1
if (j > (p-1)) j=0
t = setTimeout('runSlideShow()', slideShowSpeed)
}
</script>
<body onload="runSlideShow()">
<a href="teste1.html"><img src="balada04.jpg" name='SlideShow' width=238 height=150 border="0"></a>
</body>
alguem pode me ajudar?
abração galera
ich cara, nao entendi mto bem, pq nao sou mto bom em javascript, vi q você entende hehe.. e como ficaria o <a href="???"><img ......></a> ?? ou seria no onclick da imagem?
Faz o seguinte...
Lá onde está tua tag do link atribui um ID pra ela:
<a href="teste1.html" id="TEU ID">
Aí na tua função runSlideShow() muda a linha document.images.SlideShow.src = preLoad[j].src pra isto:
document.images.SlideShow.src = preLoad[j][0].src
document.getElementById("TEU ID").href = Pic[j][1]
Tendeu?
po cara, coloquei conforme você me falou e deu no link undefined...
meu link ficou assim: <a id="link" href="index.html"><img width="497px" height="97px" border="0" name='SlideShow'/></a> e la no getElementById coloquei link tb.. so q nao vai de jeito nenhum
Po, dei um jeitinho aki e consegui:
fiz assim oh
var Pic = new Array()
var Link = new Array()
Pic[0] = '1.jpg';
Link[0] = '1.html';
Pic[1] = '2.jpg';
Link[1] = '2.html';
Pic[2] = '3.jpg';
Link[2] = '3.html';
.
.
.
.
document.images.SlideShow.src = preLoad[j].src
document.getElementById("link").href = Link[j]
é meio uma gambiarra mas deu certo hehe
vlw pela ajuda
Ta ótimo! heheeh...
ABRAX!!!
Transforma o PIC em um arrya bidimensional e aí altera os índices! Tranquilo!
Tipo assim:
Pic[0][0] = 'balada04.jpg'
Pic[0][1] = "link aqui";
Pic[1][0] = 'balada05.jpg'
Pic[1][1] = "link aqui";
Pic[2][0] = 'balada06.jpg'
Pic[1][1] = "link aqui";
Aí lá onde você "cria" a imagem é só adicionar esse link! Pic*[0] será o caminho da imagem e Pic**[1] será o link.*
Entendeu?
ABRAX!