event listeners not listening

56 views
Skip to first unread message

xelawho

unread,
Feb 4, 2012, 12:08:54 PM2/4/12
to Google Maps JavaScript API v3
Hi. I am currently porting from v2 to v3 and have run into an
interesting problem. I have a distance calculator, which I got working
fine in v3 here:
http://xelawho.com/map/measurev3.htm

but when I plug the code into my main page (here: http://www.xelawho.com/map/v3.htm),
the event listeners (click on a marker to delete it, drag a marker to
change the line shape) stop working. I put alerts into the listener
functions, but they don't fire (but they do on the simplified
version). Naming the listeners has no effect, I get no errors in
firebug, and as far as I can tell there are no function naming
conflicts and the code is otherwise identical.

any ideas? thanks in advance.

geoco...@gmail.com

unread,
Feb 4, 2012, 12:47:40 PM2/4/12
to Google Maps JavaScript API v3
I see this difference (distmarker is global in one case, local to the
leftClick function in the other), don't know if that is the problem.
non-working version of "leftClick"
distmarker = new google.maps.Marker({
non-working version of "leftClick"
var distmarker = new google.maps.Marker({

-- Larry

MymsMan

unread,
Feb 4, 2012, 12:52:52 PM2/4/12
to google-map...@googlegroups.com
I haven't looked at the code but you may have some unwanted interaction with your wireless hotspot marker code.

When I was playing around with the options the Hotspot circle was moving around as I was drawing a line.

xelawho

unread,
Feb 4, 2012, 1:05:45 PM2/4/12
to Google Maps JavaScript API v3
thank you both for your suggestions, unfortunately the var makes no
difference on the distmarker and commenting out the whole wifi
function doesn't do anything either (the circle listener stays active
until the checkbox is unchecked, but thanks for pointing that out -
I'll have to see if I can do something about it)

geoco...@gmail.com

unread,
Feb 4, 2012, 1:13:56 PM2/4/12
to Google Maps JavaScript API v3
What browser are you testing in?

The "hanging comma" (the one after the last member of the anonymous
object) in this will cause issue in some versions of IE:
distmarker = new google.maps.Marker({
position: point,
icon: "mm_20_red.png",
shadow: "mm_20_shadow.png",
draggable:true,
map: map,
});

-- Larry

geoco...@gmail.com

unread,
Feb 4, 2012, 2:17:08 PM2/4/12
to Google Maps JavaScript API v3
On Feb 4, 10:13 am, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:
I think you need to look at the javascript errors reported on the page
that doesn't work....

Uncaught TypeError: Cannot set property 'innerHTML' of null

on:
report.innerHTML = "Total line length:<br/> " + length;

you don't seem to have a div with id="status" on the non-working
page..

-- Larry

xelawho

unread,
Feb 4, 2012, 2:37:40 PM2/4/12
to Google Maps JavaScript API v3
>   you don't seem to have a div with id="status" on the non-working
> page..

*headslap*

of course - that was the one difference between the pages. I could
have sworn I wasn't getting any errors. Thanks again, Larry.
Reply all
Reply to author
Forward
0 new messages