sg

Çarşamba, Ocak 18, 2006

can not change icon for markers on mouseover


Can you help me?

I do not understand why but I got this error
"Error: map is not defined
Source File: http://maxivanov.jino-net.ru/googlemaps/
Line: 170"

in function marker_over(id) and marker_out(id)
after this code:

[code]
<?php
require("Sajax.php");
include('config2.php');
function marker_php($maxX,$maxY,$minX,$minY)
{
connect_db();
$code='<tr>';$i=0;
$sql="SELECT * FROM geotest WHERE lt<'".$maxX."' AND lt>'".$minX."'
AND ln<'".$maxY."' AND ln>'".$minY."'";
if (! $mysql_result=mysql_query($sql)) return mysql_error();
while ($row=mysql_fetch_array($mysql_result)) {
$code.="<td><a href=".$row['url'].
" onMouseOver=marker_over(".$row['id'].
") onMouseOut=marker_out(".$row['id'].
")><img border=0 src=users/".$row['id'].".jpg></a></td>";
$i++;
if ($i==3) {$code.="</tr><tr>"; $i=0;}
}
mysql_close();
return $code;
}
$sajax_request_type = "GET";
//Инициализируем Sajax
sajax_init();
//Экспортируем в JavaScript следующие
PHP-функции
sajax_export("marker_php");
sajax_handle_client_request();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script
src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAAeKSRGhWm-JY47SO1F_lBrhRxxl1rGNIydVCmIb2xlaGB4d2ziBRG39Da98xSXuvn53zcNWVvZ9TOHg"
type="text/javascript"></script>

<script type="text/javascript">
var markers = [];
<?php sajax_show_javascript(); ?>
</script>

<script type="text/javascript">
//<![CDATA[
function onLoad()
{
//Create our "tiny" marker icon
var sidebar_html = "";
var counter = 0;
var icon = new GIcon();
icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
icon.shadow =
"http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icon.iconSize = new GSize(12, 20);
icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);

var map = new GMap(document.getElementById("map"));
map.setMapType(map.getMapTypes()[2]);
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());

function marker_over(id) {
map.removeoverlay(marker[id]);
markers[id].icon.image="http://labs.google.com/ridefinder/images/mm_20_green.png";
map.addoverlay(markers[id]);}
function marker_out(id) {
map.removeoverlay(marker[id]);
markers[id].icon.image="http://labs.google.com/ridefinder/images/mm_20_red.png";
map.addoverlay(markers[id]);}

GEvent.addListener(map, "moveend", function () {
function AjaxDo(maxX,maxY,minX,minY) {
x_marker_php(maxX,maxY,minX,minY,set_result); }
function set_result(result) {
document.getElementById("sidebar").innerHTML = result; }
AjaxDo(map.getBoundsLatLng().maxX, map.getBoundsLatLng().maxY,
map.getBoundsLatLng().minX, map.getBoundsLatLng().minY)
});

map.centerAndZoom(new GPoint(60, 60), 13);

function CreateMarker(point,id){
var marker = new GMarker(point,icon);
map.addOverlay(marker);
markers[id] = marker;
return marker;}

<?php
connect_db();
$sql="SELECT * FROM geotest";
$mysql_result=mysql_query($sql) or die(mysql_error());
while ($row=mysql_fetch_array($mysql_result))
echo "var point = new GPoint(".$row['lt'].", ".$row['ln'].");
"."CreateMarker(point, ".$row['id'].");\n";
mysql_close();
?>
}//end onLoad()
function marker_over(id) {
map.removeOverlay(markers[id]);
markers[id].icon.image="http://labs.google.com/ridefinder/images/mm_20_green.png";
map.addOverlay(markers[id]);}
function marker_out(id) {
map.removeOverlay(markers[id]);
markers[id].icon.image="http://labs.google.com/ridefinder/images/mm_20_red.png";
map.addOverlay(markers[id]);}
//]]>
</script>
</head>

<body onload="onLoad()">
<table>
<tr>
<td><div id="map" style="width: 500px; height: 400px"></div></td>
<td valign=top><div id="sidebar"></div></td>
</tr>
</table></body>
</html>
[/code]

0 Comments:

Yorum Gönder

<< Home


Komik Videolar   islam  şarkı sözleri  yemek tarifleri  gelibolu  huzur   sağlık