mouseover和mouseout ?

Discussion in 'JavaScript' started by uniojnqoifazy, Jul 10, 2012.

  1. #1
    hi all,
    when i move to the marker ,it can't show the right marker infowindow , it's only shown the last one marker info whether i move to anyone maker or not ,
    for example,
    i have 10 points(A,B,C,D.......,J), when i move to B maker , then the maker will move to J maker and shown J maker info
    is there anyone else who can help me ?



    
    <script language='javascript'>
    function addListener(marker,content){ 
                     alert(content);  //alert msg is right 
         			GEvent.addListener(marker, "mouseover", function() {           
         			   marker.openInfoWindowHtml(content);  
         			});  
     				} 
    
    </script>
     <?
           echo "<br />";
          $db->query("select IPv4,IPv6,Latitude,longitude,Description,Remarks,Op from Server;");
          $result_num = $db->get_num_rows();
    
          while($row = $db->fetch_array())
          {
             $latitude = $row['Latitude'];
             $longitude= $row['longitude'];
    		 $ipv4 = $row['IPv4'];
    		 $ipv6 = $row['IPv6'];
    		 $Remarks = $row['Remarks'];
    		 $Op= $row['Op'];
    		
    		  echo "<script language='javascript'>\n";
    		 echo "var marker = new GMarker(new GLatLng(".$latitude.",".$longitude."));\n";
    		 echo " GEvent.addListener(marker,'mouseover',function(){  ";
    		 echo  "marker.openInfoWindowHtml('".$Remarks."'); \n";
    		 echo "	});\n";
    		 echo " GEvent.addListener(marker,'mouseout',function() {  ";
    		 echo  "marker.closeInfoWindowHtml();\n";
    		 echo "	});";
    		 echo "  GEvent.addListener(marker, 'click', function() {\n";
             echo " popup('".$Op."');\n";
        	 echo "	});\n";
    		 echo "map.addOverlay(marker);\n";
    		 echo " </script>\n";
    	  }
    	  
     
    	?>
    Code (markup):
     
    uniojnqoifazy, Jul 10, 2012 IP