Click here to Skip to main content
15,907,687 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

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:

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


and my function is:
JavaScript
function launchInfoWindow() {

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

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

THANX in Advance..
Posted
Comments
Ankur Ramanuj 2-Jul-13 6:26am    
hey..anybody give me answer for this???
alert is working fine when uncomment but marker click event is not working.

1 solution

hi..
solution for above problem its to easy.

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


And assign all marker to it.just do the loop here like
JavaScript
for(int i=0; i<rowaffected;>{
gmarkers[i] = marker+i;
}

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.
JavaScript
function myclick(i){
        google.maps.event.trigger(gmarkers[i], 'click');
    };


And call this function from your link like:
HTML
<a href="java<!-- no -->script:myclick(i);">Your Link Name</a>


and for more info go on this link:http://jsfiddle.net/Uw9Qy[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900