Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mouseover image swap

Status
Not open for further replies.

FAUX

Programmer
Feb 26, 2002
5
GB
Hello,

I have a large image which does various mouseover image swaps. I have got this working fine with just one image swap but it does not seem to allow two simultaneous image swaps displaying two images at different locations.

It works for just one mouseover with :
<area shape=&quot;rect&quot; coords=&quot;229,189,323,249&quot; onmouseover=&quot;divup('cus',229,189,0,0,1)&quot;>


I have tried this for two mouseovers but this doesnot work: <area shape=&quot;rect&quot; coords=&quot;134,11,227,70&quot; onmouseover=&quot;divup('depcon',133,11,0,0,1); divup('depsec',250,11,0,0,1)&quot;>


Each div is difned as :
<div id=&quot;depcon&quot; style=&quot;visibility:hidden;top:0;left:0;width:95px;height:113px;z-index:3;position:absolute&quot; onmouseout=&quot;divdown('depcon')&quot;>
<img src=&quot;presentation-departure-concourse-mouseover.gif&quot; alt=&quot;&quot; hspace=&quot;0&quot; vspace=&quot;0&quot; border=&quot;0&quot; usemap=&quot;#depconmap&quot;>
</div>


I am wondering if it is something to do with the attached Js file. As I do not know much javascript I was wondering if anyone could advise me on this.

The JS FIle is :

var baseImageState = 0;
var LastDivUp = 0;
function getEl(id) {
if (document.all) {
return document.all.item(id);
}
}
function divup(id, x, y, s1, s2, s3) {
if (LastDivUp != 0) {
divdown(LastDivUp);
}
if ((baseImageState == 0) ||
(s1 && baseImageState == 1) ||
(s2 && baseImageState == 2) ||
(s3 && baseImageState == 3)) {
if (document.all) {
var popupEl = getEl(id);
if (popupEl != null) {
var baseEl = getEl('base');
popupEl.style.left = x + baseEl.offsetLeft;
popupEl.style.top = y + baseEl.offsetTop;
popupEl.style.visibility = &quot;visible&quot;;
LastDivUp = id;
}
}
}
}
function divdown(id) {
if (document.all) {
var popupEl = getEl(id);
if (popupEl != null) {
popupEl.style.visibility = &quot;hidden&quot;;
LastDivUp = 0;
}
}
}
function hilite (id,x,y) {
if (LastDivUp != 0) {
divdown(LastDivUp);
}

if (document.all) {
var popupEl = getEl(id);
if (popupEl != null) {
var baseEl = getEl('base');
popupEl.style.left = x + baseEl.offsetLeft;
popupEl.style.top = y + baseEl.offsetTop;
popupEl.style.visibility = &quot;visible&quot;;
LastDivUp = id;

}
}
}



All help greatly appreciated

 
stupid question but is the layer(div) over the image?

Known is handfull, Unknown is worldfull
 
Hi

Each div has it's own map - which contains the coordinates for where the mouseover swap needs to occur.

Example:

<div id=&quot;depcon&quot; style=&quot;visibility:hidden;top:0;left:0;width:95px;height:113px;z-index:3;position:absolute&quot; onmouseout=&quot;divdown('depcon')&quot;>
<img src=&quot;presentation-departure-concourse-mouseover.gif&quot; alt=&quot;&quot; hspace=&quot;0&quot; vspace=&quot;0&quot; border=&quot;0&quot; usemap=&quot;#depconmap&quot;>
</div>

is for:

<map name=&quot;depconmap&quot;>
<area shape=&quot;rect&quot; coords=&quot;100,100,195,170&quot; href=&quot;&quot;>
</map>
 
&quot;coordinates for where the mouseover swap needs to occur&quot;
its the coordinates that i asked about... are they over the main image? ie does the div show over the main image or somewhere else in the page?

Known is handfull, Unknown is worldfull
 
Bacically what needs to happen is this:-

Simultaniously I need the following to happen -
onmouseover 1 image to change plus at the same time image to change somewhere else on the page.

So two images change when a user mousesover 1 image. That 1 images needs to change + another image elsewhere.

So the image quoted in the Div needs to refer to more than one image map because each image has it's own map of coordinates.

Hope this now makes sense!

 
i asked the coordinates because it maybe that once the first div is shown (if it is over the image) the onmouseover event msy stop... therefore the second one not firing...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top