www.webdeveloper.com
Results 1 to 2 of 2

Thread: Javascript works in Chrome not on IE

  1. #1
    Join Date
    Jun 2009
    Posts
    2

    Javascript works in Chrome not on IE

    The code works in Chrome but doesnt work in IE or Mozilla..weird...

    I was fooling around with Mapstraction (http://www.mapstraction.com/)

    Just take a look please...

    HTML Code:
    <html> 
    <head> 
        <title>OpenStreetMap</title> 
     
        <!-- HTML Map element - the size must be specified here, or in the CSS --> 
    <div id="mapstraction" style="width:100%; height:100%"></div> 
     
    <!-- Map Provider & Mapstraction Javascript includes --> 
     <script src="http://www.openlayers.org/api/OpenLayers.js"></script> 
     
    <script type="text/javascript" src="http://mapstraction.com/src/mapstraction.js"></script> 
     
    <script type="text/javascript"> 
    // initialise the map with your choice of API
    var mapstraction = new Mapstraction('mapstraction','openlayers');
     
     
    // create a lat/lon object
    var myPoint = new LatLonPoint(34.4041960114344,-83.5);
     
    // display the map centered on a latitude and longitude (Google zoom levels)
    mapstraction.setCenterAndZoom(myPoint, 10);
     
    mapstraction.addControls({
        pan: true, 
        zoom: 'small',
        map_type: true 
    });
    // create a marker positioned at a lat/lon 
    my_marker = new Marker(myPoint);
     
    my_marker.setIcon('http://boston.openguides.org/markers/BLUE.png');
    mapstraction.addMarker( new Marker( new LatLonPoint(34.504,-83.008)));
     
     
    var text = "<b>Atlanta</b>";
     
    // add info bubble to the marker
    my_marker.setInfoBubble(text);
     
    // display marker 
    mapstraction.addMarker(my_marker);
     
    // open the marker
    my_marker.openBubble();
     
    mapstraction.addEventListener('click', function(p) { alert('Mapstraction Event Handling - Mouse clicked at ' + p)  });
     
    ufoo = function() { mapstraction.removeMarker(my_marker); }
     
    </script> 
     
    </body> 
     
    </html>

  2. #2
    Join Date
    Oct 2008
    Location
    U.S.
    Posts
    726
    Try it with a closing head and opening body tag

Thread Information

Users Browsing this Thread

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

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