sg

Perşembe, Aralık 15, 2005

Still having issues with IE and iframe!


This is essentially the third time I've posted this question but have
yet to receive a single response. I'm unsure if the group members find
the issue too trivial or perhaps I've actually managed to stump some
people (most likely the former). I've articulated the problem one last
time below. Any assistance would be much appreciated.

Refer to the following URL--http://www.transecology.info/maps/dev2.html
(it is a small section of a larger mapping project). The site includes
a Map (in the parent window) and a couple buttons (in a child iframe).
Using Mozilla Firefox, it is possible to display various markers on the
map by clicking the "add points" button and, alternatively, remove all
markers from the map by clicking the "clear points" button. It is also
possible to display the name of the location by clicking on the marker.

However, in Internet Explorer 6.x, it is possible to display markers by
clicking the "add points" button but the browser returns a rather
generic "invalid argument" message when I click the "clear points"
button and a "window.event is null or not an object" error when I
attempt to identify the name of a location. Note that the line and
char numbers in the IE error dialog box do not seem to correspond with
the code in either the parent or child html documents.

I'm unsure if the IE errors have something to do with: (1) how I am
referencing parent document objects (e.g., the map) in the child
iframe; (2) the names or ids of objects in either document; (3) global
vs. local variables; or other problem. The code for the parent document
and child iframe is shown below.

--CODE FOR PARENT DOCUMENT
<html>
<head>
<title>TransEcology discursive mapping project</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script
src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAAKyuNKttugi5qT8UwaDWYvxT1FtCLPRsBKy1r8LakGYAn9-0edhS0Zo9tK3oQ6DzYzIGKALjF7B6wdA"
type="text/javascript"></script>
</head>

<body bgcolor="#660000">
<div id="map" name="map" style="width: 525px; height: 400px"></div><br>
<iframe src="themes_dev2.html" id="tools" name="tools" width="525px"
height="250px"></iframe>

<script>
var map = new GMap(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GScaleControl());
map.centerAndZoom(new GPoint(-118.254, 33.9838), 4);
</script>
</body>
</html>

--CODE FOR IFRAME
<html>
<head>
<script
src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAAKyuNKttugi5qT8UwaDWYvxT1FtCLPRsBKy1r8LakGYAn9-0edhS0Zo9tK3oQ6DzYzIGKALjF7B6wdA"
type="text/javascript"></script>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF">
<div align="center"><input type="button" onClick="maptri()" value="Add
points"></div><br>
<div align="center"><input type="button" onClick="refreshmap()"
value="Clear points"></div><br>

<script type="text/javascript">
function createMarker(point,html) {
var html = "<b>" + html + "</b>";
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
});
return marker;
}

function refreshmap() {
parent.map.clearOverlays();
}

function maptri()
{
parent.map.clearOverlays();
var request = GXmlHttp.create();
request.open("Get", "maptri.pl", true);
request.setRequestHeader("ContentType", "text/xml");
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 lat = parseFloat(markers[i].getAttribute("lat"));
var lng = parseFloat(markers[i].getAttribute("lng"));
var html = markers[i].getAttribute("name");
var point = new GPoint(lng,lat);
var marker = createMarker(point,html);
parent.map.addOverlay(marker);
}
}
}
request.send(null);
}
</script>
</body>
</html>

0 Comments:

Yorum Gönder

<< Home


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