You'll find problems like this much easier to troubleshoot if you clean up
your code formatting and indentation. It's all over the place, and you can't
tell what is nested inside of what. That's probably because you've copied
and pasted code from various sources, which is fine, but you have to clean
up the indentation afterward or it will cost you extra work because you
can't see the structure of the code.

You could simply paste your JavaScript code into any of a number of online
JavaScript beautifiers which you can find with this search:

http://www.google.com/search?q=javascript+beautifier

<http://www.google.com/search?q=javascript+beautifier>I tried the first one
on that list and got good results after I turned the "preserve empty lines"
checkbox.

Many programmer's editors have built-in code formatting features - for
example I use Komodo which will do it for you.

After you do format the code, it will be easier to see problems like the one
Larry pointed out.

In addition to what he mentioned, beware that you should never put *any*
function definition inside an "if" or "for" statement or any similar nested
block. You *can* put a function directly inside another function (which can
be extremely useful) like this:

function a() {
    function b() {
    }
}

But *never* do this:

function a() {
    if( foo() ) {
        function b() {
        }
    }
}

It may work as you expect in some browsers, but will not work in all.

-Mike

On Sun, Mar 20, 2011 at 1:43 PM, Olha <[email protected]> wrote:

> Hello.
>
> I am trying to create a map with interactive markers where users can
> draw polygons around markers. Here is my script:
>
> http://abuchel.apmaths.uwo.ca/~obuchel/maps/iframes_example/drawing/gmaps-samples.googlecode.com/svn/trunk/poly/mymap2.htm
>
> It almost works as it should except for the sidebar. For some reason
> my sidebar does not understand javascript functions myclick,
> mymouseover, and mymouseout.
>
> Here is the file where the sidebar works as it is supposed to:
> http://abuchel.apmaths.uwo.ca/~obuchel/maps/iframes_example/best102.htm
>
> This file is built based on Mike Williams files.
>
> I combined this file with the geometry tools file available from
>
>
> http://code.google.com/p/gmaps-samples/source/browse/trunk/poly/mymapstoolbar.html?r=2122
>
> Both files work perfectly fine on their own, but it is hard to combine
> them.
>
> Do you possibly know a solution?
>
> Thanks,
>
> Olha
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Maps API V2" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-maps-api?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to