Support » Fixing WordPress » How to call on different javascript functions in the header.php??

  • Hi,

    I have a javascript in my header that pulls in a google map:

    <script type="text/javascript">
    		function initialize() {
    			var latlng = new google.maps.LatLng(57.0442, 9.9116);
    		var settings = {
    			zoom: 15,
    			center: latlng,
    			mapTypeControl: true,
    			mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
    			navigationControl: true,
    			navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
    			mapTypeId: google.maps.MapTypeId.ROADMAP
    var map = new google.maps.Map(document.getElementById("map_canvas"), settings);

    In the body of the post I’m using

    <body onload="initialize()">
      <div id="map_canvas" style="width:400px; height:500px"></div>

    to call on the JS and display a map in the post. The only problem with this is that I can only display one map with one location.

    I have two separate posts that I would like to use two separate maps for… one map centered on LA and the other centered on NYC

    How can I make a variable in the header so that I can call on the LA map for one post, and the NYC map for another post?

    Please help! I have very limited knowledge of WP

  • The topic ‘How to call on different javascript functions in the header.php??’ is closed to new replies.