使用asp.net调用谷歌地图api示例
更新时间:2014年08月22日 11:25:31 投稿:whsnow
这篇文章主要介绍了asp.net调用谷歌地图api的过程,需要注意js引入的先后顺序,需要的朋友可以参考下
asp.net调用谷歌地图api,需要注意js引入的先后顺序,复制一下代码即可测试
<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="设置" />
<h3>
<a href="http://maps.google.com/maps?q=China,上海&z=11" rel="external nofollow" data-geo id="AName">China,上海</a></h3>
</div>
</div>
</body>
</html>
大家可以点击复制测试一下
相关文章
asp.net core实现在线生成多个文件将多个文件打包为zip返回的操作
遇到安卓手机解压缩文件损坏问题时,可以考虑两种解决方案,方案一是使用SharpCompress库,它是一个开源项目,能够提供强大的压缩与解压功能,支持多种文件格式,方案二是采用aspose.zip库,这两种方法都能有效解决文件损坏的问题2024-11-11
.NET Core配置TLS Cipher(套件)的详细过程
本文以.NET 5为例,只不过针对.NET Core 3或3.1通过工具扫描出的协议套件结果略有所差异,但不影响我们对安全套件的配置,我们使用OpenSSL生成自签名证书,对.NET Core配置TLS Cipher相关知识感兴趣的朋友一起看看吧2021-12-12
使用DataAdapter填充多个表(利用DataRelation)的实例代码
使用DataAdapter填充多个表(利用DataRelation)的实例代码,需要的朋友可以参考一下2013-03-03


最新评论