我在教自己asp.netnet mvc 3.我閱讀本教程:http://www.codeproject.com/Articles/148949/ASP-NET-MVC-3-the-Razor-View-Engine-and-Google-Map和其他幾個這樣的帖子。不過,我還沒有能夠在我的應用程序上運行谷歌地圖。我究竟做錯了什麼?谷歌地圖+ asp .net mvc 3不工作
查看:
@section Scripts_head {
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
}
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(40.716948, -74.003563);
var options = { zoom: 14, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP };
var map = new google.maps.Map(document.getElementById("map"), options);
}
$(function() {
initialize();
});
</script>
<div id="map" style="width:80%; height:80%"></div>
我也試圖把股利在腳本標籤。
佈局頁:
<head>
...
@RenderSection("Scripts_head", false)
</head>
控制器:
public class MapController : Controller
{
//
// GET: /Map/
public ActionResult Index()
{
return View();
}
}
任何運氣?我正在按照相同的教程爲mvc 4做這個,並且無法看到任何結果。 – bruno
這只是地圖大小,導致我的問題。 – Tripping