Javascript来自数据库的图像上的图像映射

[英]Javascript Image map on image from database


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.

我使用下面的displayMainImage.php链接调用图像,并且工作正常,它从mysql数据库中提取图像名称。我现在正在尝试将图像映射连接到图像,该部分不起作用。这是可能的,如果是这样的话。下面的代码是在php网站上运行的javascript。

<?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>

1 个解决方案

#1


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.

“usemap”属性应位于“img”元素上,而不应位于脚本标记上。

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

另一方面,该函数应具有比“openit()”更具描述性的名称。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2009/06/01/4f50251dd9dec81dbf877fe3a0187d4c.html



 
粤ICP备14056181号  © 2014-2020 ITdaan.com