添加GoogleMap时遇到问题,见代码:html:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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 runat="server">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>test</title><link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initialize() {
var myLatlng = new google.maps.LatLng(34.2183, 108.9650);
var myOptions = {
zoom: 4,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions); //debugger;
var ds = _Default.getProjectMessage().value;
if(ds != null && typeof(ds) == "object" && ds.Tables != null)
{
for(var i = 0 ; i < ds.Tables[0].Rows.length ; i ++ )
{
myLatlng = new google.maps.LatLng(ds.Tables[0].Rows[i].lat.toString(), ds.Tables[0].Rows[i].lon.toString());
var image = "hq.gif";
var er = new google.maps.Marker({
position: myLatlng,
map: map,
title:ds.Tables[0].Rows[i].ProjectName.toString(),
icon:image
});
attachSecretMessage(er, i , ds);
}
}
}
function attachSecretMessage(er, i , ds) {
var contentString =
'<div id="content" style="font-size:12px">'+
'项目名称:'+ ds.Tables[0].Rows[i].ProjectName.toString() + '<br />' +
'项目周期:'+ ds.Tables[0].Rows[i].Cycle.toString() +'"&rrr&"'+ '<br />' +
'灯具个数:'+ ds.Tables[0].Rows[i].Num.toString() + '<br />' +
'备 注:'+ ds.Tables[0].Rows[i].Re.toString() + '<br />' +
'前总功率:'+ ds.Tables[0].Rows[i].BeforePower.toString() + '<br />' +
'后总功率:'+ ds.Tables[0].Rows[i].AfterPower.toString() + '<br />' +
'节 能 率:'+ ds.Tables[0].Rows[i].SavingRate.toString() + '<br />' +
'日作小时:'+ ds.Tables[0].Rows[i].DateAndHour.toString() + '<br />' +
'年作天数:'+ ds.Tables[0].Rows[i].YearDays.toString() + '<br />' +
'月节能量:'+ ds.Tables[0].Rows[i].SectionEnergy.toString() + '<br />' +
'适用电价:'+ ds.Tables[0].Rows[i].ApplicableTariff.toString() + '<br />' +
'分享比例:'+ ds.Tables[0].Rows[i].SharingRatio.toString() + '<br />' +
'减排补贴:'+ ds.Tables[0].Rows[i].SubsidyReduction.toString() + '<br />' +
'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
}); google.maps.event.addListener(er, 'click', function() {
infowindow.open(er.get('map'), er);
});
} </script></head><body onload="initialize()">
<form id="form1" runat="server">
<div id="map_canvas" style="width:800px; height:550px"></div>
</form>
</body>
</html>
后台返回DataSet没有问题,返回值也没有问题,可是,
运行的时候,报错,eval.code 页面
return a.padding=b
参数无效
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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 runat="server">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>test</title><link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initialize() {
var myLatlng = new google.maps.LatLng(34.2183, 108.9650);
var myOptions = {
zoom: 4,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions); //debugger;
var ds = _Default.getProjectMessage().value;
if(ds != null && typeof(ds) == "object" && ds.Tables != null)
{
for(var i = 0 ; i < ds.Tables[0].Rows.length ; i ++ )
{
myLatlng = new google.maps.LatLng(ds.Tables[0].Rows[i].lat.toString(), ds.Tables[0].Rows[i].lon.toString());
var image = "hq.gif";
var er = new google.maps.Marker({
position: myLatlng,
map: map,
title:ds.Tables[0].Rows[i].ProjectName.toString(),
icon:image
});
attachSecretMessage(er, i , ds);
}
}
}
function attachSecretMessage(er, i , ds) {
var contentString =
'<div id="content" style="font-size:12px">'+
'项目名称:'+ ds.Tables[0].Rows[i].ProjectName.toString() + '<br />' +
'项目周期:'+ ds.Tables[0].Rows[i].Cycle.toString() +'"&rrr&"'+ '<br />' +
'灯具个数:'+ ds.Tables[0].Rows[i].Num.toString() + '<br />' +
'备 注:'+ ds.Tables[0].Rows[i].Re.toString() + '<br />' +
'前总功率:'+ ds.Tables[0].Rows[i].BeforePower.toString() + '<br />' +
'后总功率:'+ ds.Tables[0].Rows[i].AfterPower.toString() + '<br />' +
'节 能 率:'+ ds.Tables[0].Rows[i].SavingRate.toString() + '<br />' +
'日作小时:'+ ds.Tables[0].Rows[i].DateAndHour.toString() + '<br />' +
'年作天数:'+ ds.Tables[0].Rows[i].YearDays.toString() + '<br />' +
'月节能量:'+ ds.Tables[0].Rows[i].SectionEnergy.toString() + '<br />' +
'适用电价:'+ ds.Tables[0].Rows[i].ApplicableTariff.toString() + '<br />' +
'分享比例:'+ ds.Tables[0].Rows[i].SharingRatio.toString() + '<br />' +
'减排补贴:'+ ds.Tables[0].Rows[i].SubsidyReduction.toString() + '<br />' +
'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
}); google.maps.event.addListener(er, 'click', function() {
infowindow.open(er.get('map'), er);
});
} </script></head><body onload="initialize()">
<form id="form1" runat="server">
<div id="map_canvas" style="width:800px; height:550px"></div>
</form>
</body>
</html>
后台返回DataSet没有问题,返回值也没有问题,可是,
运行的时候,报错,eval.code 页面
return a.padding=b
参数无效
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货