I am getting a problem in wordpress plugin. I have made a image area map which is located at the location.
In this I have created two area maps.
When I click first time on any area map, then it shows the pop up
but when I again click on the any of the area map then it gives error in console
hello is not a function
I am using the code as follow :
<script>
function hello(id){
var path = "<?php echo $path; ?>";
alert(id);
var path = path+id+'/'+id+'.jpg';
image = "<img src='"+path+"' id='hello'>";
//alert(image);
jQuery("#hidden").html(image);
var newwindow = window.open(jQuery(this).prop('href'), '', 'height=800,width=800');
// if (window.focus) {
newwindow.focus();
newwindow.document.write( jQuery("#hidden").html() );
//}
return false;
}
</script>
<div style="width: 900px; overflow: scroll; float: left;">
<img src="<?php echo $img_src;?>" id="photo" style="width: 850px;" usemap="#planetmap" />
</div>
<map name="planetmap">
<?php
$sql = mysql_query("select * from epaper");
while($row = mysql_fetch_array($sql)){
$xx = $row['file_id'];
echo '<area shape="rect" style="cursor:pointer;" coords="'.$row['x1'].','.$row['y1'].','.$row['x2'].','.$row['y2'].'" target="_blank" onclick="return hello('.$xx.');" alt="Sun" onmouseover="borderit(this,"black")" onmouseout="borderit(this,"white")">';
}
?>
<div id="hidden" style="display:none;">
</div>
</map>
Please guys help me to come out of the problem
Aucun commentaire:
Enregistrer un commentaire