Help linking
So I created my interactive map here:
http://jimabbott.taylorpond.com/version4/test.html
The file calls an xml file (data.xml) (snipet below)
<?xml version="1.0" encoding="UTF-8"?>
<markers>
<marker name="11th and B" lng="-117.154709" lat="32.717876"
address1="11th and B St" address2="San Diego, CA"
image1="11th_and_B.jpg" image2="" click="http://www.yahoo.com"
health="http://www.yahoo.com"/>
<marker name="15th and Island" lng="-117.151903" lat="32.710503"
address1="Island and 14th St" address2="San Diego, CA"
image1="15th_and_Island.jpg" image2="" click="" health=""/>
Problem #1 The link to yahoo.com works in Mozilla not IE
Problem #2 How do I generate a javascript popup from the property info
window to launch a window with a specific size?
test.html code posted below:
<!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"
xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html;
charset=UTF-8"/>
<title>Jim Abbott Downtown Property Search Map</title>
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
<script
src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAAv0-q0FNVJ_D1ASp8-3y4yBRs3WI5doqzYKTBc_ipIxmndAQEgBTUGCmi2_gAvBeKGxuvA0hHDI4ZgA"
type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var map;
if (window.location !=
"http://jimabbott.taylorpond.com/version4/test.html")
{
/* I suggest putting an alert here to tell users that you are moving
them to the right page for the API */
window.location = "http://jimabbott.taylorpond.com/version4/test.html";
}
// Creates the map frame and centers it on San Diego
function CreateMap(){
map = new GMap(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.centerAndZoom(new GPoint(-117.159316, 32.718520), 2);
return map;
}
function disp_alert()
{
alert("I am an alert box!!")
}
// Creates a marker whose info window displays the given number
function createMarker(point, number, name, address1, address2, link2,
picture1, picture2, health) {
// Creates a marker class(?)
var marker = new GMarker(point);
// Show this marker's index in the info window when it is clicked
var html = "<img src=/images/transparent.gif" + " height=1 width=250
hspace=0 vspace=0 border=0><br>" + "<a href=" + link2 + ">" + " " +
name + "</a><br>" + "<img src=/images/" + picture1 + " height=110
hspace=4 vspace=10 border=1>" + "<img src=/images/" + picture2 + "
height=110 hspace=4 vspace=10 border=1><br>"+ address1 + "<br>" +
address2 + "<br><a href=" + health + ">Property Information</a></div>";
// Open and display variable called html when clicked
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
function onLoad() {
map = CreateMap();
// Center the map on Seattle
// Download the data in data.xml and load it on the map. The format we
// expect is:
// <markers>
// <marker lat="37.441" lng="-122.141"/>
// <marker lat="37.322" lng="-121.213"/>
// </markers>
var request = GXmlHttp.create();
// Specify the xml file
request.open("GET", "data.xml", true);
request.onreadystatechange = function() {
if (request.readyState == 4) {
var xmlDoc = request.responseXML;
var markers =
xmlDoc.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var point = new
GPoint(parseFloat(markers[i].getAttribute("lng")),
parseFloat(markers[i].getAttribute("lat")));
var name = markers[i].getAttribute("name");
var address1 = markers[i].getAttribute("address1");
var address2 = markers[i].getAttribute("address2");
var link2 = markers[i].getAttribute("click");
var picture1 = markers[i].getAttribute("image1");
var picture2 = markers[i].getAttribute("image2");
var health = markers[i].getAttribute("health");
var marker = createMarker(point, i + 1, name, address1, address2,
link2, picture1, picture2, health);
// Actually places all the points on the map
map.addOverlay(marker);
}
}
}
request.send(null);
}
function redrawmap() {
// Center the map on Seattle
// Download the data in data.xml and load it on the map. The format we
// expect is:
// <markers>
// <marker lat="37.441" lng="-122.141"/>
// <marker lat="37.322" lng="-121.213"/>
// </markers>
// var map = CreateMap();
// Specify the xml file
map.clearOverlays();
var request = GXmlHttp.create();
request.open("GET", "data2.xml", true);
request.onreadystatechange = function() {
if (request.readyState == 4) {
var xmlDoc = request.responseXML;
var markers =
xmlDoc.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var point = new
GPoint(parseFloat(markers[i].getAttribute("lng")),
parseFloat(markers[i].getAttribute("lat")));
var name = markers[i].getAttribute("name");
var address1 = markers[i].getAttribute("address1");
var address2 = markers[i].getAttribute("address2");
var link2 = markers[i].getAttribute("click");
var picture1 = markers[i].getAttribute("image1");
var picture2 = markers[i].getAttribute("image2");
var health = markers[i].getAttribute("health");
var marker = createMarker(point, i + 1, name, address1, address2,
link2, picture1, picture2, health);
// Actually places all the points on the map
map.addOverlay(marker);
}
}
}
request.send(null);
}
//]]>
</script>
</head>
<body onload="onLoad()">
<div id="map" style="width: 800px; height: 600px"></div>
<div id="message"></div>
<p>
<script type="text/javascript" language="javascript">
var sc_project=732352;
var sc_partition=6;
var sc_security="667f22ed";
</script>
</p>
<!-- End of StatCounter Code -->
</p>
</body>
</html>
0 Comments:
Yorum Gönder
<< Home