Ich probiere gerade das jQuery Plugin jQuery GPS aus (http://www.birdwingfx.com/jQuery_gps/index.html) Eigentlich funktioniert alles, aber man braucht eine Google Maps API Code/ Schlüssel. Aber den gibt es ja gar nicht mehr. Was mach ich jetzt? Wie bekomme ich das trotzdem hin?
Den Code bekommt ihr auf der Website oder hier:
**PHP Code:**
**JS Code**PHP-Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="de">
<head>
<title>Routenplanner</title>
<style>
#map {
width: 500px;
height: 200px;
}
</style>
<script type="text/javascript" src="jquery.js"></script>
<script src="//HIER WÜRDE DER CODE REIN KOMMEN//" type="text/javascript"></script>
<script type="text/javascript" src="gps.jquery.js"></script>
<script type="text/javascript">
$(function() {
$("#map").googleMap().load();
});
</script>
</head>
<body onunload="GUnload()">
<div id="directions"></div>
<div id="map"></div>
<form action="directions.php" method="post">
<p><b>From: </b><input id="end" type="text" value="2333 El Jobean Road Port Charlotte, FL 33948" />
<b>To: </b><input id="start" type="text" /></p>
<input name="submit" id="getdirections" type="submit" value="Get Directions" />
</form>
</body>
</html>
Vielen Dank!HTML-Code:(function($) { $.GoogleMapObjectDefaults = { zoomLevel: 10, imagewidth: 50, imageheight: 50, center: '2000 Florida Ave NW Washington, DC 20009-1231', start: '#start', end: '#end', directions: 'directions', submit: '#getdirections', tooltip: 'false', image: 'false' }; function GoogleMapObject(elementId, options) { /* private variables */ this._inited = false; this._map = null; this._geocoder = null; /* Public properties */ this.ElementId = elementId; this.Settings = $.extend({}, $.GoogleMapObjectDefaults, options || ''); } $.extend(GoogleMapObject.prototype, { init: function() { if (!this._inited) { if (GBrowserIsCompatible()) { this._map = new GMap2(document.getElementById(this.ElementId)); this._map.addControl(new GSmallMapControl()); this._geocoder = new GClientGeocoder(); } this._inited = true; } }, load: function() { //ensure existence this.init(); if (this._geocoder) { //"this" will be in the wrong context for the callback var zoom = this.Settings.zoomLevel; var center = this.Settings.center; var width = this.Settings.imagewidth; var height = this.Settings.imageheight; var map = this._map; if (this.Settings.tooltip != 'false') { var customtooltip = true; var tooltipinfo = this.Settings.tooltip; } if (this.Settings.image != 'false') { var customimage = true; var imageurl = this.Settings.image; } this._geocoder.getLatLng(center, function(point) { if (!point) { alert(center + " not found"); } else { //set center on the map map.setCenter(point, zoom); if (customimage == true) { //add the marker var customiconsize = new GSize(width, height); var customicon = new GIcon(G_DEFAULT_ICON, imageurl); customicon.iconSize = customiconsize; var marker = new GMarker(point, { icon: customicon }); map.addOverlay(marker); } else { var marker = new GMarker(point); map.addOverlay(marker); } if(customtooltip == true) { marker.openInfoWindowHtml(tooltipinfo); } } }); } //make this available to the click element $.data($(this.Settings.submit)[0], 'inst', this); $(this.Settings.submit).click(function(e) { e.preventDefault(); var obj = $.data(this, 'inst'); var outputto = obj.Settings.directions; var from = $(obj.Settings.start).val(); var to = $(obj.Settings.end).val(); map.clearOverlays(); var gdir = new GDirections(map, document.getElementById(outputto)); gdir.load("from: " + from + " to: " + to); //open the google window //window.open("http://maps.google.com/maps?saddr=" + from + "&daddr=" + to, "GoogleWin", "menubar=1,resizable=1,scrollbars=1,width=750,height=500,left=10,top=10"); }); return this; } }); $.extend($.fn, { googleMap: function(options) { // check if a map was already created var mapInst = $.data(this[0], 'googleMap'); if (mapInst) { return mapInst; } //create a new map instance mapInst = new GoogleMapObject($(this).attr('id'), options); $.data(this[0], 'googleMap', mapInst); return mapInst; } }); })(jQuery);
Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)