asp.net html5地理位置 [英] asp.net html5 geolocation

查看:56
本文介绍了asp.net html5地理位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,专家,

我一直在尝试学习一些非常琐碎的东西,但到目前为止还没有做到.所以我现在请您协助.

我有这个

Hi Experts,

I have been trying to learn something very trivial but have not been able to as yet; so I now revert to your assistance.

I have this

<div id="mapDiv"  runat="server" style="....."</div>



我一直在尝试通过同一页面上的链接按钮将map.setView(....)命令传递给它.



and I''ve been trying to pass to it a map.setView(....) command through a linkbutton from the same page.

map = new Microsoft.Maps.Map(document.getElementById("mapDiv"))



您能指出如何执行此操作吗?

到目前为止,离我最近的猜测是



Can you please indicate how to do this?

The closest guess from my side so far has been

<asp:LinkButton ID="LinkButton1" Text="Change Location" OnClick="javascript:Loc1();" runat="server"





and

Loc1 = function(){map.setView(........)}



我知道这是不对的,但不要给人留下错误的印象,我对此非常绿色:(

非常感谢,
贾斯汀

代码位于此处





I know this is not right but don''t get the wrong impression, I''m just very green at this :(

Thanks a lot,
Justin

the code lies hereunder



<table class="style1">
      <tr>
          <td>

              <h1>Geolocation demo</h1>
    <div id="mapDiv"  style="position: relati..........);">
              </div>


          </td>

          <td>

              <div id="accordion">
              <h3><a href="#">North Region</a></h3>
              <div>
   <asp:LinkButton ID="LinkButton1" Text="Location 1" OnClientClick="javascript:NT1();" runat="server"/>
                  <p>Location 2</p>
                  <p>Location 3</p>
              </div>

              </div>


          </td>
      </tr>
  </table>



  <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>

  <script type="text/javascript">
      var map = null;
      window.onload = function ()
      {
          /* Replace YOUR_BING_MAPS_KEY with your own credentials.
          Obtain a key by signing up for a developer account at
          http://www.microsoft.com/maps/developers/ */
          var cred = "YOUR_BING_MAPS_KEY";
          // Initialize map
          map = new Microsoft.Maps.Map(document.getElementById("mapDiv"),
          { credentials: cred, showDashboard: false });
     :
     :
     :
     :

      NT1 = function ()
      {
          map.setView({ zoom: 5, center: new Microsoft.Maps.Location(35.96592, 14.344196) })
      }
</script>

推荐答案

Sir;
我认为您正在尝试在客户端Silde上调用Loc1().因此,您需要使用属性OnClientClick而不是OnClick,因为OnClickClick事件添加了处理程序.

Sir;
I think you are trying to call Loc1() on the client-silde. So you would need to use the property OnClientClick instead of OnClick because OnClick adds a handler to Click event.

<asp:LinkButton ID="LinkButton1" Text="Change Location" OnClientClick="javascript:Loc1();return false;" runat="server" />


这篇关于asp.net html5地理位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆