http://geodit.com:8000/test如何使用javascript模拟鼠标点击(在Google地图中)?
在这里,我有一个简单的Google本地搜索API和Google地图代码。
我该如何做到这一点,以便当我点击搜索结果的标题时,我模拟点击地址?我的目标是通过单击标题使弹出框出现在地图上。我绑定到这:
$(".gs-title").click(function(){
//SIMULATE MOUSE CLICK of the address HERE
$(this).parent().parent().find(".gs-address").click(); // this doesn't work!!
alert("the title was clicked!!"); //this works fine.
return false; //this also works fine. The hyperlink gets disabled because I returned false.
});
我希望能够点击标题,而不是打开链接。然后,弹出地图上的框。换句话说,我想把整个结果看待。
你确定`$(this).parent()。parent()。find(“.gs-address”)`实际上是在找到你认为它的结果吗? – Pointy 2011-01-12 19:02:11
我确实看到它打开弹出罚款,当我点击结果。但我也看到弹出窗口打开。如果我只是点击地址区域而不是标题,那么它就是你想要的。我错过了什么? – spinon 2011-01-12 19:03:17
我希望能够点击标题,而不是打开链接。然后,弹出地图上的框。换句话说,我想把整个结果看待。 – TIMEX 2011-01-12 19:11:03