ca1775,陈香吟,雯京网
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>
大家可以点击复制测试一下
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Blazor server side 自家的一些开源的, 实用型项目的进度之 CEF客户端
.NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)
vue+.netcore可支持业务代码扩展的开发框架 VOL.Vue 2.0版本发布
网友评论