On 10月23日, 下午6时34分, "warden [Andrew Leach - Maps API Guru]"
<[EMAIL PROTECTED]> wrote:
> On Oct 23, 9:34 am, NiNi <[EMAIL PROTECTED]> wrote:
>
> > Icannotrun the most simple demo of Google Maps API on aspx in IE.
> > The error messages are about the jscript, missing }, missing objects,
> > etc.. But Icanrun the same code on html format. That's why? help.
>
> The API runs in the client, and shouldn't depend on what the server
> does. Except that ASPX does odd things with sessions and forms andcan
> upset what the browser has to interpret. We may be able to advise if
> you follow the posting guidelines and give a link to your failing
> page.http://groups.google.com/group/Google-Maps-API/web/suggested-posting-...
>
> Andrew
This is the script of my aspx file and html file. The aspx can not run
while the html can work. Thanks very much for your help.
ASPX:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test2.aspx.cs"
Inherits="test2" %>
<!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>
<title>Google Maps JavaScript API Example</title>
<script src="http://maps.google.com/maps?
file=api&v=2&key=ABQIAAAA-
U6XhAESLs1tCp83Y70CyRS63TPv8zdREAvx2P3wrzlPzLS1hhRswuZAkWs2iBsWh8ELJHBJqojBBA"
type="text/javascript" language="javascript"></script>
<script language="javascript" type="text/javascript" >
var map = null;
var geocoder = null;
function initialize(){
if (GBrowserIsCompatible()){
map = new GMap2(document.getElementById("map_canvas"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
geocoder = new GClientGeocoder();}
}
function showAddress(address){
if (geocoder){
geocoder.getLatLng(address,
function(point){
if (!point){
alert(address + " not found");}
else{
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(address);
}});}}
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<form action="#" onsubmit="showAddress(this.address.value); return
false">
<p>
<input type="text" size="60" name="address" value="1600
Amphitheatre Pky, Mountain View, CA" />
<input type="submit" value="Go!" />
</p>
<div id="map_canvas" style="width: 500px; height: 300px"></div>
</form>
</body>
</html>
HTML:
<!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>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/
>
<title>Google Maps JavaScript API Example</title>
<script src="http://maps.google.com/maps?
file=api&v=2&key=ABQIAAAA-
U6XhAESLs1tCp83Y70CyRS63TPv8zdREAvx2P3wrzlPzLS1hhRswuZAkWs2iBsWh8ELJHBJqojBBA"
type="text/javascript"></script>
<script type="text/javascript">
var map = null;
var geocoder = null;
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
geocoder = new GClientGeocoder();
}
}
function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(address);
}
}
);
}
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<form action="#" onsubmit="showAddress(this.address.value); return
false">
<p>
<input type="text" size="60" name="address" value="1600
Amphitheatre Pky, Mountain View, CA" />
<input type="submit" value="Go!" />
</p>
<div id="map_canvas" style="width: 500px; height: 300px"></div>
</form>
</body>
</html>
ody>
</html>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---