Passing array as parameter google maps

This question already has an answer here:

  • Google Map addDomListener function parameter 2 answers

  • Error: Expected ")"

    google.maps.event.addDomListener(window, 'load', initialize(markers());
    

    should be

    google.maps.event.addDomListener(window, 'load', initialize(markers()));
    

    It was something about how load functions:

    google.maps.event.addDomListener(window, 'load', initialize(markers())); 

    this method, google load "initialize()" before all, then markers() doesn't exist already.

    so if you move to

    body
    the script and the markers() to
    head
    works perfectly.

    链接地址: http://www.djcxy.com/p/81514.html

    上一篇: 如何将谷歌地图放在JQUERY Mobile上?

    下一篇: 传递数组作为参数谷歌地图