JavaScript - mostrar imagen dinamica

 
Vista:
sin imagen de perfil

mostrar imagen dinamica

Publicado por noseke (7 intervenciones) el 28/06/2010 12:45:23
hola amigos toy con la api de google map intentando k al hacer click en uno de los puntos k cojo de la base de datos para mostrar la foto k tengo asignada a ese punto en otro div fuera del mapa:

Todo lo k es el codigo del mapa funciona bien, pero e intentado de muchas formas hacerlo y no doy con el kit, habe si me podeis hechar una mano en el planteamiento, gracias, en un comentario os muestro donde iria e codigo

<?php
$query_rsGmap = "SELECT * FROM museos_prueba";
$rsGmap = mysql_query($query_rsGmap, $link) or die(mysql_error());
$row_rsGmap = mysql_fetch_assoc($rsGmap);
$totalRows_rsGmap = mysql_num_rows($rsGmap);
$marcadores = "[";
if ($totalRows_rsGmap > 0) { // Show if recordset not empty
do {
if ($marcadores == "["){
$marcadores.= "{";
}else{
$marcadores.= ",{";
}
$marcadores.= "'latitud':".$row_rsGmap['latitud'].", 'longitud':".$row_rsGmap['longitud'].", 'nombre': '".$row_rsGmap['nombre']."'";
$marcadores.= "}";
} while ($row_rsGmap = mysql_fetch_assoc($rsGmap));
} // Show if recordset not empty
$marcadores.= "]";

echo $marcadores;
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Google Maps JavaScript API Example</title>
<script src="http://maps.google.com/maps?file=api&v=2&key= ABQIAAAAZqPP3UqvHFFs62KYqSnNkBTN7shGZJLt3_DZdAN6LJijc3LBPxQQ9RDci87FmPL05diXCsdh8_KrvA" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var centrarLatitud = 37.38264;
var centrarLongitud = -5.996295;
var zoomInicio = 14;

var map;

function adMarcador(latitud, longitud, descripcion) {
var marcador = new GMarker(new GLatLng(latitud, longitud));

//AKI IRIA LA SENTENCIA PARA MOSTRAR LA FOTO CUANDO HACEMOS CLICK
GEvent.addListener(marcador, 'click',
function() {
marcador.openInfoWindowHtml(descripcion);
}
);

map.addOverlay(marcador);
}

function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.setCenter(new GLatLng(centrarLatitud, centrarLongitud), zoomInicio);
marcadores = <?php echo $marcadores; ?>;
for(id in marcadores) {
adMarcador(marcadores[id].latitud, marcadores[id].longitud, marcadores[id].nombre);
alert(marcadores[id].latitud);
}
}
}
//]]>
</script>
</head>
<body onload='load()' onunload='GUnload()'>
<div id="map" style="width: 500px; height: 300px"></div>
<div id="recarga"></div>
</body>
</html>
<?php
mysql_free_result($rsGmap);
?>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder