脚本宝典收集整理的这篇文章主要介绍了使用asp.net调用谷歌地图api示例,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
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调用谷歌地图api示例全部内容,希望文章能够帮你解决使用asp.net调用谷歌地图api示例所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。