tags:

views:

181

answers:

1

I call an image using the displayMainImage.php link below and that works fine, it pulls the image name from a mysql database. I am now trying to connect an image map to the image, that part isn't working. Is this possible and if so how. The below code is in javascript running on a php site.

<?php echo '
<script language="javascript">

function openit() {
newWindow = window.open(\'http://www.mysite.com/front_page/\', \'dfac\', \'width=900,height=700\');
}

</script>  
'; ?>  <br/>


<script language="JavaScript" type="text/javascript" 
src="http://www.mysite.com/idevaffiliate/displayMainImage.php?token=logo" usemap="#Map">

<map name="Map" id="Map">  
  <area shape="rect" coords="175,247,366,280" href="javascript:openit();" />
</map>
A: 

Yes, it's possible. Is the following missing open tag a typo?

area shape="rect" coords="175,247,366,280" href="javascript:openit();" />

Should be:

<area shape="rect" coords="175,247,366,280" href="javascript:openit();" />

The "usemap" attribute should be on the "img" element, not on a script tag.

On another note, the function should have a more descriptive name than "openit()".

jthompson