Jump to content

Styling an image map?


carinemaz
 Share

Recommended Posts

Hi all!Is it possible to apply different styles to text that is called by onmouseover in an images map?say I'd like the first one "Pen An Dalar" in blue, and the second one "Moulin" in red...How do I add the css??I've tried to add an <h1>, like they show in the tutorials.... but not workinghere is the code...

<head><style type="text/css">#desc {font-family: Arial, Helvetica, sans-serif;font-size: 16px;font-weight: bold;color: #34339B;}</style><script type="text/javascript">function writeText(txt){document.getElementById("desc").innerHTML=txt}</script></head><body><div id="main"><img src="images/carte-medipsy.gif" alt="Emplacement des Etablissements MEDIPSY" border="0" usemap="#Map" title="Emplacement des Etablissements MEDIPSY" /><map name="Map" id="Map">  <area shape="rect" coords="5,132,26,153" href="#" alt="Pen An Dalar" onMouseOver="writeText('Pen An Dalar\n Directeur:\n Jean LE MARTRET\n147, rue de Paris\n29490 GUIPAVAS\nTel: 02 98 84 76 25\n Fax: 02 98 84 88 92')" onmouseout="writeText(' ')" />    <area shape="rect" coords="97,161,116,176" href="#" alt="Moulin" onMouseOver="writeText('Moulin\n Directrice:\nJoelle MODE\nCarcé BP 7138\n35171 BRUZ Cedex\nTel: 02 99 05 05 05\n Fax: 02 99 05 05 99')" onmouseout="writeText(' ')" />  <p id="desc"></p></div></body></html>

Link to comment
Share on other sites

i think so :) try putting a span around the text<span color=\"blue\">Pen An Dalar<\/span><span color=\"red\">Moulin<\/span>The above coding may be slightly incorrect, i couldn't test it without your image, can you post a link to your page?

Link to comment
Share on other sites

sorry, does work i just made a stupid typo, my css was naff, this idea works: onmouseover="writeText('<span style=\'color:red\'>Pen An Dalar</span>\n Directeur:\n Jean LE MARTRET<br />

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...