Connecting Tech Pros Worldwide Help | Site Map

changing div styles in image maps

prash.marne@gmail.com
Guest
 
Posts: n/a
#1: Feb 28 '07
hi all,
this is an intresting thing ,

i have a simple image map (with world map image),

in which i have diffrent regions specified ,also i have mentioned the
region names next to the map image
so now the functionality i want is :-

whenever the user hovers on the region (lets say :europe) the text
(europe) next to the image should change to bold & also the color
should change .

in the same way i have to change many dives for diffent regions

any help how i can change the classes for those dives after user
hovers on it ..? ,

thanks in advance,

Prashant.

ASM
Guest
 
Posts: n/a
#2: Feb 28 '07

re: changing div styles in image maps


prash.marne@gmail.com a écrit :
Quote:
whenever the user hovers on the region (lets say :europe) the text
(europe) next to the image should change to bold & also the color
should change .
>
in the same way i have to change many dives for diffent regions

function boldIt(what) {
what = document.getElementById(what).style;
what.fontWeight = what.fontWeight=''? 'bold' : '';
}

<map ...
<area onmouseover="boldIt('div1');" onmouseout="boldIt('div1');" ...

<dt id="div1">Europe</dt>


and if you prefer class :

function boldIt(what) {
what = document.getElementById(what);
what.className = what.className=''? 'highlight' : '';
}


Idea :
------

CSS :
=====
#myMap { border:1px solid black; padding: 8px }
#myMap img { float: left; width: 200px; }
#myMap dl { position:relative; margin-left: 210px }
#myMap dt { color: blue }
#myMap dt.highligth { font-weight: bold; color: red }
#myMap dd { visibility: hidden }
#myMap dd.highligth { visibily: visible }

JS :
====
function higtLight(what) {
var D = document.getElementById('text_'+what);
var L = document.getElementById('legend_'+what);
D.className = D.className=''? 'highlight' : '';
L.className = L.className=''? 'highlight' : '';
}

HTML :
======
<div id="myMap">
<img usemap="#wrldMap"
src="world.jpg" alt"World Map" title"Oveflow me" />
<dl>
<dt id="legend_eur'>Europe</dt>
<dd id="text_eur'>Somewhere in North side</dd>
<dt id="legend_asi'>Asia</dt>
<dd id="text_asi'>Somewhere in South side</dd>
</dl>
<map name="wrldMap>
<AREA HREF="europe.htm" ... blah ...
onmouseover="higtLight('eur');"
onmouseout="higtLight('eur');>
<AREA HREF="asia.htm"... blah ...
onmouseover="higtLight('asi');"
onmouseout="higtLight('asi');>
</map>
</div>

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
prash.marne@gmail.com
Guest
 
Posts: n/a
#3: Feb 28 '07

re: changing div styles in image maps


hey tahnks for your reply ,
u guys are relly helpful for beginers like me...

but the thing dosent work in my case i have tried a simple one ...
<html>
<head>
<script type="text/javascript">

function boldIt(what) {
what = document.getElementById(what).style;
what.fontWeight = what.fontWeight=''? 'bold' : '';
}
</script>
</head>
<body>
<img scr="wrld_map.jpg" type="image/jpg" usemap="#wrldMap">
<map name="wrldMap"
<area href="#" shape="poly" coords="........"
onmouseover="boldIt('div1');" onmouseout="boldIt('div1');">
</map>
<div id="div1">Europe</div>
</body>
</html>

do i need to add some more stuff ....?? or i am getting wrong
somwhere ...??
thanks,

ASM
Guest
 
Posts: n/a
#4: Feb 28 '07

re: changing div styles in image maps


prash.marne@gmail.com a écrit :
Quote:
hey tahnks for your reply ,
Please left some trace of post you're answering.
Quote:
u guys are relly helpful for beginers like me...
>
but the thing dosent work in my case i have tried a simple one ...
Quote:
<html>
<head>
<script type="text/javascript">
/* *** Ooops ! little error ! **** */

function boldIt(what) {
what = document.getElementById(what).style;
what.fontWeight = what.fontWeight==''? 'bold' : '';
}
Quote:
</script>
</head>
<body>
<img scr="wrld_map.jpg" type="image/jpg" usemap="#wrldMap">
<map name="wrldMap"
<area href="#" shape="poly" coords="........"
with real coords it would be better
Quote:
onmouseover="boldIt('div1');" onmouseout="boldIt('div1');">
</map>
<div id="div1">Europe</div>
</body>
</html>
>
do i need to add some more stuff ....?? or i am getting wrong
somwhere ...??
Not seems so.

And if you try the "idea"
correct it same way as above (two '=' insteed one '=' in condition)

function higtLight(what) {
var D = document.getElementById('text_'+what);
var L = document.getElementById('legend_'+what);
D.className = D.className==''? 'highlight' : '';
L.className = L.className==''? 'highlight' : '';
}


--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
prash.marne@gmail.com
Guest
 
Posts: n/a
#5: Mar 9 '07

re: changing div styles in image maps


On Feb 28, 11:15 pm, ASM <stephanemoriaux.NoAd...@wanadoo.fr.invalid>
wrote:
Quote:
prash.ma...@gmail.com a écrit :
>
Quote:
hey tahnks for your reply ,
>
Please left some trace of post you're answering.
>
Quote:
u guys are relly helpful for beginers like me...
>
Quote:
but the thing dosent work in my case i have tried a simple one ...
<html>
<head>
<script type="text/javascript">
>
/* *** Ooops ! little error ! **** */
>
function boldIt(what) {
what = document.getElementById(what).style;
what.fontWeight = what.fontWeight==''? 'bold' : '';
>
}
Quote:
</script>
</head>
<body>
<img scr="wrld_map.jpg" type="image/jpg" usemap="#wrldMap">
<map name="wrldMap"
<area href="#" shape="poly" coords="........"
>
with real coords it would be better
>
Quote:
onmouseover="boldIt('div1');" onmouseout="boldIt('div1');">
</map>
<div id="div1">Europe</div>
</body>
</html>
>
Quote:
do i need to add some more stuff ....?? or i am getting wrong
somwhere ...??
>
Not seems so.
>
And if you try the "idea"
correct it same way as above (two '=' insteed one '=' in condition)
>
function higtLight(what) {
var D = document.getElementById('text_'+what);
var L = document.getElementById('legend_'+what);
D.className = D.className==''? 'highlight' : '';
L.className = L.className==''? 'highlight' : '';
>
}
>
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
cool the problem is solved....
thanks once again.....

Closed Thread