Bonjour,
Dans une table j'essaye de placer une image de fond qui correspond a la résolution du visiteur de cette façon le site sera compatible avec plusieurs résolution d'écrans, mon problèmes c'est qu'il applique toujours le dernier "backgr" quand j'essaye alert(backgr); il me donne le screen.width exact dnas mon cas milieu1024.png mais alors pour quoi il applique l'image milieu1280.png au lieu de milieu1024.png
Pouvez vous m'aider SVP
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 <script> if (screen.width>=1024) backgr="images/fond/milieu1024.png" backgr2="images/fond/top1024.png" if (screen.width>=1280) backgr="images/fond/milieu1280.png" backgr2="images/fond/top1280.png" if (screen.width>=1680) backgr="images/fond/milieu1680.png" backgr2="images/fond/top1680.png" // alert(backgr); document.write('<td width="100%" height="100" style="background-image:url('+backgr2+'); background-repeat: repeat-y"><table border="0" width="100%" height="100%" style="background-image:url('+backgr+'); background-repeat: repeat-y">') </script>
Merci
Partager