www.webdeveloper.com
Results 1 to 3 of 3

Thread: Google maps stopping other Javascript

  1. #1
    Join Date
    Dec 2009
    Posts
    1

    Google maps stopping other Javascript

    Hi Developers,

    Ok, so my knowledge of Javascript is very limited and I've come up with a problem. After finding some code for validating all fields in a form I implemented it into my website. I struggle for ages to find out why it wasnt working. I eventually found that taking out Google Maps onload="initialize()" from the <body> allowed the JS to work however the maps ceased to work. I was therefore wondering if anyone knew how to get around this problem and have both features in my website??

    Thanks guys

  2. #2
    Join Date
    Dec 2009
    Posts
    1
    if there is an error in the google map api part of the code that you wrote on the page, then definitely loading process will stop at the error which occurred; unless ur other js code is not written under the same scope, ur other js code won't be loaded

  3. #3
    Join Date
    Oct 2008
    Location
    U.S.
    Posts
    726
    I eventually found that taking out Google Maps onload="initialize()" from the <body> allowed the JS to work however the maps ceased to work. I was therefore wondering if anyone knew how to get around this problem and have both features in my website??
    This would lead me to believe you have conflict somewhere with another script requiring an onload event. Try using the google GEvent to start the initialize function when the window has loaded:
    Code:
    <script type="text/javascript">
    //this does not have to be in it's own script tags, 
    //could add in to the script where your initialize function is.
    GEvent.addDomListener(window, 'load', initialize);
    </script>
    Last edited by astupidname; 12-09-2009 at 06:29 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles