Mega Code Archive

 
Categories / JavaScript DHTML / Ext JS
 

Google map window

<!-- /*!  * Ext JS Library 3.0.0  * Copyright(c) 2006-2009 Ext JS, LLC  * licensing@extjs.com  * http://www.extjs.com/license  */   -->  <!-- Revised from Ext JS Library 3.0.0 -->  <html> <head> <title>Hello World Window</title> <link rel="stylesheet" type="text/css" href="ext-3.0.0/resources/css/ext-all.css" /> <script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script> <script type="text/javascript" src="ext-3.0.0/ext-all.js"></script> <!-- GMaps API Key that works for www.extjs.com --> <!--<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA2CKu_qQN-JHtlfQ5L7BLlRRadLUjZPtnrRT4mXZqcP4UUH-2OxREmPm3GpN_NHsHuvuHd-QKI4YoRg" type="text/javascript"></script>--> <!-- GMaps API Key that works for localhost --> <script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAA2CKu_qQN-JHtlfQ5L7BLlRT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQl3I3p2yrGARYK4f4bkjp9NHpm5w" type="text/javascript"></script>     <script src="ext-3.0.0/examples/ux/GMapPanel.js"></script>     <script>     /*!  * Ext JS Library 3.0.0  * Copyright(c) 2006-2009 Ext JS, LLC  * licensing@extjs.com  * http://www.extjs.com/license  */ Ext.onReady(function(){     var mapwin;     var button = Ext.get('show-btn');     button.on('click', function(){         // create the window on the first click and reuse on subsequent clicks         if(!mapwin){             mapwin = new Ext.Window({                 layout: 'fit',                 title: 'GMap Window',                 closeAction: 'hide',                 width:400,                 height:400,                 x: 40,                 y: 60,                 items: {                     xtype: 'gmappanel',                     region: 'center',                     zoomLevel: 14,                     gmapType: 'map',                     mapConfOpts: ['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],                     mapControls: ['GSmallMapControl','GMapTypeControl','NonExistantControl'],                     setCenter: {                         geoCodeAddr: '4 Yawkey Way, Boston, MA, 02215-3409, USA',                         marker: {title: 'Fenway Park'}                     },                     markers: [{                         lat: 42.339641,                         lng: -71.094224,                         marker: {title: 'Boston Museum of Fine Arts'},                         listeners: {                             click: function(e){                                 Ext.Msg.alert('Its fine', 'and its art.');                             }                         }                     },{                         lat: 42.339419,                         lng: -71.09077,                         marker: {title: 'Northeastern University'}                     }]                 }             });                      }                  mapwin.show();              });       });     </script> </head> <body> <h1>GMap Window</h1> <p>This example shows how to create an extension and utilize an external library.</p> <input type="button" id="show-btn" value="Gimme a Map" /><br /><br /> </body> </html>