Slideshow + lien

matix59 Messages postés 4 Date d'inscription vendredi 18 juillet 2008 Statut Membre Dernière intervention 18 juillet 2008 - 18 juil. 2008 à 10:51
lolonaae Messages postés 1 Date d'inscription mercredi 29 janvier 2003 Statut Membre Dernière intervention 3 décembre 2008 - 3 déc. 2008 à 14:02
bonjour à tous ,
j'ai un code pour faire un slideshow en javascript , le problème c'est que je ne sais pas comment ajouter un lien URL à chaque image.

<!-- BBCode Start --><table cellspacing="0" cellpadding="5" width="100%" bgcolor="#e6effe" border="0">----, <tt><script language=\"JavaScript1.2\">
//Fade-in image slideshow- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use
var slideshow_width='730px' //SET IMAGE WIDTH
var slideshow_height='170px' //SET IMAGE HEIGHT
var pause=5000 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)
var fadeimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages[0]=\"http://img257.imageshack.us/img257/1958/admsonyjs6.jpg\"
fadeimages[1]=\"http://img141.imageshack.us/img141/9097/admnintendoil7.jpg\"
fadeimages[2]=\"adm_microsoft.jpg\"
////NO need to edit beyond here/////////////
var preloadedimages=new Array()
for (p=0;p<fadeimages.length;p++){
preloadedimages[p]=new Image()
preloadedimages[p].src=fadeimages[p]
}
var ie4=document.all
var dom=document.getElementById
if (ie4||dom)
document.write('

')
else
document.write('')
var curpos=10
var degree=10
var curcanvas=\"canvas0\"
var curimageindex=0
var nextimageindex=1
function fadepic(){
if (curpos<100){
curpos+=10
if (tempobj.filters)
tempobj.filters.alpha.opacity=curpos
else if (tempobj.style.MozOpacity)
tempobj.style.MozOpacity=curpos/100
}
else{
clearInterval(dropslide)
nextcanvas=(curcanvas==\"canvas0\")? \"canvas0\" : \"canvas1\"
tempobj=ie4? eval(\"document.all.\"+nextcanvas) : document.getElementById(nextcanvas)
tempobj.innerHTML=''
nextimageindex=(nextimageindex<fadeimages.length-1)? nextimageindex+1 : 0
setTimeout(\"rotateimage()\",pause)
}
}
function rotateimage(){
if (ie4||dom){
resetit(curcanvas)
var crossobj=tempobj=ie4? eval(\"document.all.\"+curcanvas) : document.getElementById(curcanvas)
crossobj.style.zIndex++
var temp='setInterval(\"fadepic()\",50)'
dropslide=eval(temp)
curcanvas=(curcanvas==\"canvas0\")? \"canvas1\" : \"canvas0\"
}
else
document.images.defaultslide.src=fadeimages[curimageindex]
curimageindex=(curimageindex<fadeimages.length-1)? curimageindex+1 : 0
}
function resetit(what){
curpos=10
var crossobj=ie4? eval(\"document.all.\"+what) : document.getElementById(what)
if (crossobj.filters)
crossobj.filters.alpha.opacity=curpos
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=curpos/100
}
function startit(){
var crossobj=ie4? eval(\"document.all.\"+curcanvas) : document.getElementById(curcanvas)
crossobj.innerHTML=''
rotateimage()
}
if (ie4||dom)
window.onload=startit
else
setInterval(\"rotateimage()\",pause)
</script></tt></td>
</td></tr></tbody></table><!-- BBCode End -->

En vous remerciant d'avance ,

7 réponses

Zobibol Messages postés 469 Date d'inscription mercredi 9 janvier 2002 Statut Membre Dernière intervention 20 février 2017 6
18 juil. 2008 à 11:06
Bien le bonjour, pour une fois du code y en a ;o)

voir en gras dans le source.
<script language= "JavaScript1.2">
//Fade-in image slideshow- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use
var slideshow_width='730px' //SET IMAGE WIDTH
var slideshow_height='170px' //SET IMAGE HEIGHT
var pause=5000 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)
var fadeimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages[0]="http://img257.imageshack.us/img257/1958/admsonyjs6.jpg"
fadeimages[1]="http://img141.imageshack.us/img141/9097/admnintendoil7.jpg"
fadeimages[2]="adm_microsoft.jpg"

// Définition des liens.
// Le liens 0 est lié à l'image 0 et ainsi de suite.
var linkImage = new Array();
linkImage[0] = "http://www.javascriptFr.com";
linkImage[1] = "http://www.google.com";
linkImage[2] = "http://www.yahoo.fr";

////NO need to edit beyond here/////////////
var preloadedimages=new Array()
for (p=0;p<fadeimages.length;p++){
preloadedimages[p]=new Image()
preloadedimages[p].src=fadeimages[p]
}
var ie4=document.all
var dom=document.getElementById
if (ie4||dom)
document.write('

')
else
document.write(' ['+linkImage[0]+' ]')
var curpos =10
var degree= 10
var curcanvas="canvas0"
var curimageindex=0
var nextimageindex=1
function fadepic(){
if (curpos<100){
curpos+=10
if (tempobj.filters)
tempobj.filters.alpha.opacity=curpos
else if (tempobj.style.MozOpacity)
tempobj.style.MozOpacity=curpos/100
}
else{
clearInterval(dropslide)
nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj.innerHTML=' ['+linkImage[nextimageindex]+' ]'
nextimageindex =(nextimageindex<fadeimages.length-1)? nextimageindex+1 : 0
setTimeout("rotateimage()",pause)
}
}
function rotateimage(){
if (ie4||dom){
resetit(curcanvas)
var crossobj= tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.style.zIndex++
var temp='setInterval("fadepic()",50)'
dropslide=eval(temp)
curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
}
else
document.images.defaultslide.src=fadeimages[curimageindex]
curimageindex=(curimageindex<fadeimages.length-1)? curimageindex+1 : 0
}
function resetit(what){
curpos=10
var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
if (crossobj.filters)
crossobj.filters.alpha.opacity=curpos
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=curpos/100
}
function startit(){
var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.innerHTML=' ['+linkImage[curimageindex]+' ]'
rotateimage()
}
if (ie4||dom)
window.onload =startit
else
setInterval("rotateimage()",pause)
</script>

et normalement ! ça doit être pas mal !

[o-_-o]
0
matix59 Messages postés 4 Date d'inscription vendredi 18 juillet 2008 Statut Membre Dernière intervention 18 juillet 2008
18 juil. 2008 à 12:12
Un grand merci à toi de part ta rapidité et surtout de l'aide à insérer les liens.

Merci à toi
0
matix59 Messages postés 4 Date d'inscription vendredi 18 juillet 2008 Statut Membre Dernière intervention 18 juillet 2008
18 juil. 2008 à 12:39
juste encore un petit truc ,
comment je peux faire pour enlever le contour du lien ( ligne bleue ) ?
0
Zobibol Messages postés 469 Date d'inscription mercredi 9 janvier 2002 Statut Membre Dernière intervention 20 février 2017 6
18 juil. 2008 à 12:45
utilise le style, j'avais pas percuter ce problème...
un truc du genre
<style>
    img{
       border:0px;
    }
</style>

devrait être amplement sufficant !

[o-_-o]
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
banbanfr Messages postés 132 Date d'inscription dimanche 8 janvier 2006 Statut Membre Dernière intervention 15 février 2011
18 juil. 2008 à 13:50
le px n'est pas obligatoire :)

img{border:0;}
0
matix59 Messages postés 4 Date d'inscription vendredi 18 juillet 2008 Statut Membre Dernière intervention 18 juillet 2008
18 juil. 2008 à 14:05
merci beaucoup , tout fonctionne correctement.

merci
0
lolonaae Messages postés 1 Date d'inscription mercredi 29 janvier 2003 Statut Membre Dernière intervention 3 décembre 2008
3 déc. 2008 à 14:02
Petite contribution:
Pour retirer le contour bleu du lien image il faut ajouter le code suivant : style= "border:0" comme ci-dessous en gras:

<script language="JavaScript1.2">
//Fade-in image slideshow- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use
var slideshow_width='730px' //SET IMAGE WIDTH
var slideshow_height='170px' //SET IMAGE HEIGHT
var pause=5000 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)
var fadeimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages[0]="http://img257.imageshack.us/img257/1958/admsonyjs6.jpg"
fadeimages[1]="http://img141.imageshack.us/img141/9097/admnintendoil7.jpg"
fadeimages[2]="adm_microsoft.jpg"

// Définition des liens.
// Le liens 0 est lié à l'image 0 et ainsi de suite.
var linkImage = new Array();
linkImage[0] = "http://www.javascriptFr.com";
linkImage[1] = "http://www.google.com";
linkImage[2] = "http://www.yahoo.fr";

////NO need to edit beyond here/////////////
var preloadedimages=new Array()
for (p=0;p<fadeimages.length;p++){
preloadedimages[p]=new Image()
preloadedimages[p].src=fadeimages[p]
}
var ie4=document.all
var dom=document.getElementById
if (ie4||dom)
document.write('

')
else
document.write('['+linkImage[0]+' ]')
var curpos=10
var degree=10
var curcanvas="canvas0"
var curimageindex=0
var nextimageindex=1
function fadepic(){
if (curpos<100){
curpos+=10
if (tempobj.filters)
tempobj.filters.alpha.opacity=curpos
else if (tempobj.style.MozOpacity)
tempobj.style.MozOpacity=curpos/100
}
else{
clearInterval(dropslide)
nextcanvas=(curcanvas=="canvas0")? "canvas0" : "canvas1"
tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj.innerHTML='['+linkImage[nextimageindex]+' ]'
nextimageindex =(nextimageindex<fadeimages.length-1)? nextimageindex+1 : 0
setTimeout("rotateimage()",pause)
}
}
function rotateimage(){
if (ie4||dom){
resetit(curcanvas)
var crossobj= tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.style.zIndex++
var temp='setInterval("fadepic()",50)'
dropslide=eval(temp)
curcanvas=(curcanvas=="canvas0")? "canvas1" : "canvas0"
}
else
document.images.defaultslide.src=fadeimages[curimageindex]
curimageindex=(curimageindex<fadeimages.length-1)? curimageindex+1 : 0
}
function resetit(what){
curpos=10
var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
if (crossobj.filters)
crossobj.filters.alpha.opacity=curpos
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=curpos/100
}
function startit(){
var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.innerHTML='['+linkImage[curimageindex]+' ]'
rotateimage()
}
if (ie4||dom)
window.onload =startit
else
setInterval("rotateimage()",pause)
</script>
0
Rejoignez-nous