google.maps.event.trigger无法在c#中运行 [英] google.maps.event.trigger is not working in c#

查看:101
本文介绍了google.maps.event.trigger无法在c#中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





i在谷歌地图触发器中有一个问题。我想点击链接打开信息窗口,我有多个标记。

i在html中创建了一个函数,我在运行时调用了链接的点击事件

但触发器无效。

我的简单代码是:





i have one problem in google maps trigger.i want to open info window on click of link and i have multiple marker.
i have created one function in html which i called at run time on click event of link
but trigger is not working.
my simple code is:

<a href=java<!-- no -->script:launchInfoWindow();>Open info</a>





我的功能是:



and my function is:

function launchInfoWindow() {

    //alert("x");
     google.maps.event.trigger(marker0, 'click' );
     }



但它不起作用我从2天开始坚持这个... / ....



THANX提前..


but its not worked i'm stuck in this from 2 days.../....

THANX in Advance..

推荐答案

嗨..

解决上述问题很容易。



为标记定义一个数组,例如

hi..
solution for above problem its to easy.

define one array for marker like
var gmarkers = [];





并将所有标记分配给它。只需在这里循环就像



And assign all marker to it.just do the loop here like

for(int i=0; i<rowaffected;>{
gmarkers[i] = marker+i;
}



这里我有mareker名称像marker1,marker2,3,4,5 ....所以'i'正在为这个系列工作。



最后在js中创建一个函数。


here i have mareker name like marker1,marker2,3,4,5....so the 'i' is working for this series.

And finally create one function in js.

function myclick(i){
        google.maps.event.trigger(gmarkers[i], 'click');
    };





并通过以下链接调用此函数:



And call this function from your link like:

<a href="java<!-- no -->script:myclick(i);">Your Link Name</a>





和更多信息请访问此链接: http: //jsfiddle.net/Uw9Qy [ ^ ]


这篇关于google.maps.event.trigger无法在c#中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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