使用asp.net調(diào)用谷歌地圖api示例
更新時(shí)間:2014年08月22日 11:25:31 投稿:whsnow
這篇文章主要介紹了asp.net調(diào)用谷歌地圖api的過程,需要注意js引入的先后順序,需要的朋友可以參考下
asp.net調(diào)用谷歌地圖api,需要注意js引入的先后順序,復(fù)制一下代碼即可測試
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>//在這里要注意js引入的先后順序
<link href="Mapjs/jquery.ui.base.css" rel="external nofollow" rel="stylesheet" type="text/css" />
<link href="Mapjs/jquery.ui.theme.css" rel="external nofollow" rel="stylesheet" type="text/css" />
<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script src="Mapjs/jquery.ui.core.js" type="text/javascript"></script>
<script src="Mapjs/jquery.ui.widget.js" type="text/javascript"></script>
<script src="Mapjs/jquery.ui.position.js" type="text/javascript"></script>
<script src="Mapjs/jquery.ui.tooltip.js" type="text/javascript"></script>
<link href="Mapjs/demos.css" rel="external nofollow" rel="stylesheet" type="text/css" />
<style type="text/css">
.photo
{
width: 300px;
text-align: center;
}
.photo .ui-widget-header
{
margin: 1em 0;
}
.map
{
width: 350px;
height: 350px;
}
.ui-tooltip
{
max-width: 350px;
}
</style>
<script type="text/javascript">
$(function () {
$(document).tooltip({
items: "img, [data-geo], [title]",
content: function () {
var element = $(this);
if (element.is("[data-geo]")) {
var text = element.text();
return "<img class='map' alt='" + text +
"' src='http://maps.google.com/maps/api/staticmap?" +
"zoom=11&size=350x350&maptype=terrain&sensor=false¢er=" +
text + "'>";
}
if (element.is("[title]")) {
return element.attr("title");
}
if (element.is("img")) {
return element.attr("alt");
}
}
});
$('#Button1').click(function () {
$('#AName').text($('#Text1').val());
$('#AName').attr('href', "http://maps.google.com/maps?q="+$('#Text1').val()+"&z=11");
})
});
</script>
</head>
<body>
<div class="ui-widget photo">
<div class="ui-widget-header ui-corner-all">
<input id="Text1" type="text" value="China,上海" /><input id="Button1" type="button"
value="設(shè)置" />
<h3>
<a rel="external nofollow" data-geo id="AName">China,上海</a></h3>
</div>
</div>
</body>
</html>
大家可以點(diǎn)擊復(fù)制測試一下
相關(guān)文章
asp.net實(shí)現(xiàn)訪問局域網(wǎng)共享目錄下文件的解決方法
這篇文章主要介紹了asp.net實(shí)現(xiàn)訪問局域網(wǎng)共享目錄下文件的解決方法,需要的朋友可以參考下2014-07-07
.NET必知的EventCounters性能指標(biāo)監(jiān)視器詳解
這篇文章主要介紹了.NET必知的EventCounters性能指標(biāo)監(jiān)視器,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-11-11
asp.net實(shí)現(xiàn)的DES加密解密操作示例
這篇文章主要介紹了asp.net實(shí)現(xiàn)的DES加密解密操作,結(jié)合具體實(shí)例形式分析了asp.net實(shí)現(xiàn)DES加密與解密算法的實(shí)現(xiàn)技巧,需要的朋友可以參考下2017-07-07
寫一個(gè)含數(shù)字,拼音,漢字的驗(yàn)證碼生成類
本文和大家分享的是一個(gè)集成1:小寫拼音;2:大寫拼音;3:數(shù)字;4:漢字的驗(yàn)證碼生成類。本章例子也會有一個(gè)mvc使用驗(yàn)證碼校驗(yàn)的場景。具有一定的參考價(jià)值,下面跟著小編一起來看下吧2017-01-01

