Hye,
You will find here under a script which will load a picture in a layer ,
picture depending on the cursor position. Everything's ok until the line:
document.getElementById('zoom').style.background=" url('chemin
image.gif')";
which doesn't work.
The script works (indication in the status barre) but the image is not
loaded in the layer...
I'm quiet sure it's a problem of url syntaxe but I can't find it ???
<script language="JavaScript" type="text/JavaScript">
nom_precedent = "/images/panorama_1.gif";
function position(e) {
x = (navigator.appName.substring(0,3) == "Net") ? e.pageX :
event.x+document.body.scrollLeft;
y = (navigator.appName.substring(0,3) == "Net") ? e.pageY :
event.y+document.body.scrollTop;
posx = Math.ceil(x/1014*21);
posy = Math.ceil(y/290*12)-1;
if (posx<=1) posx=1;
if (posx>=21) posx=21;
if (posy<=0) posy=0;
if (posy>=7) posy=11;
num = posx+(posy*21);
nom = "../../../../_images/_trainers_050124/images/panorama_"+num+".gif";
if (nom != nom_precedent) {
window.status = "Souris posx:"+posx+" | posy:"+posy+" | numéro:"+num+" |
image:"+nom;
// Netscape
if (document.getElementById){
document.getElementById('zoom').style.background=" url('../../../../_images/_trainers_050124/images/panorama_51.gif')";
}
if (document.all && !document.getElementById){
document.all['zoom'].style.background="url('../../../../_images/_trainers_050124/images/panorama_51.gif')";
}
// IE
if (document.layers) {
document.layers['zoom'].style.background="url('../../../../_images/_trainers_050124/images/panorama_51.gif')";
}
nom_precedent = nom;
}
}
if (navigator.appName.substring(0,3) == "Net")
document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = position;
</SCRIPT>
</HEAD>
<!--C.Candas, 2004.-->
<BODY BGCOLOR="#FFFFFF">
<img src="../../../../_images/_trainers_050124/panorama_flat.jpg"
width="1014" height="290" border="0">
<p align="center" class="retrait">Glissez la souris sur la zone de l'image
que vous souhaitez agrandir ci dessous.</p>
<div id="zoom" style="position:absolute; width:500px; height:250px;
z-index:1; visibility: visible; left: 257px; top: 346px; background-image:
url(../../../../_images/_trainers_050124/images/panorama_54.gif);
layer-background-image:
url(../../../../_images/_trainers_050124/images/panorama_54.gif); border:
1px none #000000;"></div>
Thanks in advance for your help.
Christophe