JavaScript - Google Earth Api Javascript Problem
Hi folks,
My website is located he http://maps.peachtree-city.org My search functions point to a mysql database and has been working since June 2008. All of sudden, and I credit my boss to this, it has become dysfunctional with a reoccuring error noted by Firefox: Syntax Error: 0Query was empty. I have a php within the server which pulls from my map file to call upon mysql: From the map.html Code: function submitAddress() { var address = document.getElementById('address').value; var searchUrl = 'http://maps.peachtree-city.org/google/parcelpin_genxml2.php?address=' + address; GDownloadUrl(searchUrl, function(data) { var xml = GXml.parse(data); var markers = xml.getElementsByTagName('marker'); if (markers.length == 0) { alert('Sorry, no Address matches found. Remember to check your spelling and format.'); return; } var address1 = markers[0].getAttribute('address') var point = new GLatLng(parseFloat(markers[0].getAttribute('lat')), parseFloat(markers[0].getAttribute('lng'))); if (point && ge != null) { var la = ge.createLookAt(''); la.set(point.y, point.x, 100, ge.ALTITUDE_RELATIVE_TO_GROUND, 0, 0, 500); placemark.setName(address); var point1 = ge.createPoint(address1); point1.setLatitude(point.y); point1.setLongitude(point.x); placemark.setGeometry(point1); ge.getView().setAbstractView(la); } }); } The form from map.html Code: <center><p style="font-family:arial narrow" "color=green" size="1">Search <strong>Address</strong> Example: 1232 S Hwy 74</font></p></center> <form name='searchform2' id='searchform2' action="javascript:void(0);"> <input type=text size=21 id='address' ></input> <input type=submit button style="background-color:orange" value='Search Address' onClick='javascript:submitAddress();'> <input type=reset button style="background-color:orange" value='Clear Form'> </form> <br> The searchURL (parcelpin_genxml2.php) Code: <?php require ("phpsql_dbinfo.php"); function parseToXML($htmlStr) { $xmlStr=str_replace('<','<',$htmlStr); $xmlStr=str_replace('>','>',$xmlStr); $xmlStr=str_replace('"','"',$xmlStr); $xmlStr=str_replace("'",''',$xmlStr); $xmlStr=str_replace("&",'&',$xmlStr); return $xmlStr; } // Opens a connection to a mySQL server $connection=mysql_connect (localhost, $user, $password); if (!$connection) { die('Not connected : ' . mysql_error()); } // Set the active mySQL database $db_selected = mysql_select_db('geocode', $connection); if (!$db_selected) { die ('Can\'t use db : ' . mysql_error()); } // Select all the rows in the markers table $query = ""; if ($address != null) { $tok = strtok($address, " "); $count = 0; $query = "SELECT * FROM address WHERE "; while ($tok !== false) { if ($count > 0) { $query = $query." and "; } $query = $query." address like '%$tok%'"; $tok = strtok(" "); $count = $count + 1; } } else if ($parcelpin != null) { $query = "SELECT * FROM parcel WHERE parcelpin='$parcelpin'"; } $result = mysql_query($query); if (!$result) { die("Invalid query " + $query . mysql_error()); } header("Content-type: text/xml"); // Start XML file, echo parent node echo '<markers>'; // Iterate through the rows, printing XML nodes for each while ($row = @mysql_fetch_assoc($result)){ // ADD TO XML DOCUMENT NODE echo '<marker '; if ($address != null) { echo 'address="' . $row['address'] . '" '; } else if ($parcelpin != null) { echo 'parcelpin="' . $row['parcelpin'] . '" '; } echo 'lat="' . $row['lat'] . '" '; echo 'lng="' . $row['lng'] . '" '; echo '/>'; } // End XML file echo '</markers>'; mysql_close(); ?> I am at a complete lost why the error. Boss says he didn't touch anything but I noticed he did add another table to mysql which led me finding out he also tried installing a CMS , SugarCMS. Upon research on this, I found some mentions of SugarCMS contributing to errors on other mysql databases. Similar TutorialsI have managed to get a model to load and to load multiple models, however i cannot seem to work out how to get these models to move. I have seen it done so i know there is a way in which it can be done, any help would be much appreciated. Also if anyone knows how to create and load custom terrain and stuff thats something i'd like to klnow how to do. fly_earth_chung is a small free flight / car simulator i have written using google earth plugin and javascript. you can find it there => http://chungswebsite.blogspot.com/se...ly_earth_chung Hi there, I'm putting together a GeoCaching book for iPad that I intend to shop around upon completion. I have hit a stumbling block though. I want the co-ordinates in the PDF to open the Google Earth application. Using the current hyperlinks, the iPad links to Google Maps instead. Is it possible, using Javascript, to create a code that will directly open the Google Earth application and take the reader to those exact co-ordinates? Thanks in advance, WR Hi, Not sure where to post this. I currently have a web app which utilises Google Maps & Directions, however some of these maps and directions will be used in pdf creation with tcpdf. The problem arises with the fact that tcpdf doesn't read javascript and therefore cant show the map. Any ideas on what I can do to compensate? Hi, i have 1 site with three different brands (three ID numbers). I have made a javascript if-statement but it doesnt work. Somebody see some wrong here, I think it should work properly. Thanks in advance $language and $brand is set... <script type="text/javascript"> var accountId; var url; if($language == 'test') { if($brand = '1') { accountId = 'UA-xxxxx-1' url = '1.com' } else if ($brand = '2') { accountId = 'UA-xxxxx-2' url = '2.com' } else if ($brand = '3') { accountId = 'UA-xxxxx-3' url = '3.com' } var _gaq = _gaq || []; _gaq.push(['_setAccount', accountId]); _gaq.push(['_setDomainName', url]); _gaq.push(['_setAllowLinker', true]); _gaq.push(['_trackPageview', '/' + window.location.host + '/' + window.location.pathname]); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> Sorry for the rather noob question, but I am a beginner after all. Why won't my canvas graphics get rendered? And how can I make it work using this technique? Code: <!doctype html> <html lang = "en"> <head> <meta charset = "UTF-8"> <title>CH1EX1:Basic Hello World HTML page</title> <script src = "http://www.modernizr.com/downloads/modernizr-2.0.6.js"></script> <script type = "text/javascript"> window.addEventListener("load", eventWindowLoaded, false); function eventWindowLoaded(){ canvasApp(); } function canvasApp(){ var canvas = document.getElementById("canvas0ne") var context = canvas.getContext("2d"); function drawScreen(){ context.fillStyle = "ffffaa"; context.fillRect(0, 0, 500, 300); context.fillStyle = "#000000" context.font = "20px _sans"; context.textBaseline = "top"; context.fillText ("Hello World!", 195, 80); } context.strokeStyle = "#000000"; context.strokeRect(5, 5, 490, 290); } drawScreen(); </script> </head> <body> <div style = "position: absolute; top: 50px; left: 50px;"> Hello world :)! <canvas id = "canvas0ne" width = "500" height = "300> Your browser does not appear to support canvas. Please download a modern browser such as Chrome. </canvas> </div> </body> </html> http://www.cricketcoachingclinics.com.au/ I am having a problem with site in IE7 this is identified as a problem?? Can someone at least rule out this js error? This is js generated when adding google maps Error Class is not defined <CODE>var GoogleMap=Class.create(Widget,{widgetIdentifier:"com-apple-iweb-widget-GoogleMap",initialize:function($super,instanceID,widgetPath,sharedPath,sitePath,preferences,runningI nApp) {if(instanceID){$super(instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp);}},mapReq uestTemplate:'center=#{center}&zoomLevel=#{zoomLevel}&showZoom=#{showZoom}&mapType=#{mapType}&locate dAddress=#{locatedAddress}&locatedAddressPoint=#{locatedAddressPoint}&showInfo=#{showInfo}&language= #{language}&showGoogleBar=#{showGoogleBar}',iframeTemplate:'<iframe id="#{instanceID}-iframe" name="#{instanceID}-iframe" src="#{mapURL}?#{mapRequest}" width="100%" height="100%" scrolling="no" marginheight="0" marginwidth="0" frameborder="0"></iframe>',mapURL:'http://www.me.com/st/1/sharedassets/maps/iweb2/',onload:function() {var mapRequestTemplate=new Template(this.mapRequestTemplate);var mapRequest=mapRequestTemplate.evaluate({center:this.escapedPreferenceForKey("center"),zoomLevel:this .escapedPreferenceForKey("zoomLevel"),showZoom:this.escapedPreferenceForKey("showZoom"),mapType:this .escapedPreferenceForKey("mapType"),locatedAddress:this.escapedPreferenceForKey("locatedAddress"),lo catedAddressPoint:this.escapedPreferenceForKey("locatedAddressPoint"),showInfo:this.escapedPreferenc eForKey("showInfo"),language:this.escapedPreferenceForKey("language"),showGoogleBar:this.escapedPref erenceForKey("showGoogleBar")});var iframeTemplate=new Template(this.iframeTemplate);var iframeText=iframeTemplate.evaluate({instanceID:this.instanceID,mapRequest:mapRequest,mapURL:this.map URL});this.div().innerHTML=iframeText;if(this.preferences&&this.preferences.postNotification) this.preferences.postNotification("BLWidgetIsSafeToDrawNotification",1);},escapedPreferenceForKey:fu nction(key) {var value=this.preferenceForKey(key);if(value!==undefined) value=encodeURIComponent(value);return value;}});</CODE> I have a working script and I want to add a toogleGroup command (which I have) to the end of the working script so that I can toggle map markers with radio buttons. Probably a simple addition. WORKING CODE: Code: //<![CDATA[ var iconPink = new GIcon(); iconPink.image = 'http://www.golfinggreys.com/img/ggmap_icon_attraction.png'; iconPink.shadow = ''; iconPink.iconSize = new GSize(24, 31); iconPink.shadowSize = new GSize(0, 0); iconPink.iconAnchor = new GPoint(11, 30); iconPink.infoWindowAnchor = new GPoint(5, 1); var iconOrange = new GIcon(); iconOrange.image = 'http://www.golfinggreys.com/img/ggmap_icon_accomm.png'; iconOrange.shadow = ''; iconOrange.iconSize = new GSize(24, 31); iconOrange.shadowSize = new GSize(0, 0); iconOrange.iconAnchor = new GPoint(11, 30); iconOrange.infoWindowAnchor = new GPoint(5, 1); var iconPurple = new GIcon(); iconPurple.image = 'http://www.golfinggreys.com/img/ggmap_icon_dining.png'; iconPurple.shadow = ''; iconPurple.iconSize = new GSize(24, 31); iconPurple.shadowSize = new GSize(0, 0); iconPurple.iconAnchor = new GPoint(11, 30); iconPurple.infoWindowAnchor = new GPoint(5, 1); var iconGreen = new GIcon(); iconGreen.image = 'http://www.golfinggreys.com/img/ggmap_icon_golf.png'; iconGreen.shadow = ''; iconGreen.iconSize = new GSize(24, 31); iconGreen.shadowSize = new GSize(0, 0); iconGreen.iconAnchor = new GPoint(11, 30); iconGreen.infoWindowAnchor = new GPoint(5, 1); var iconRed = new GIcon(); iconRed.image = 'http://www.golfinggreys.com/img/ggmap_icon_golfr.png'; iconRed.shadow = ''; iconRed.iconSize = new GSize(24, 31); iconRed.shadowSize = new GSize(0, 0); iconRed.iconAnchor = new GPoint(11, 30); iconRed.infoWindowAnchor = new GPoint(5, 1); var iconGrey = new GIcon(); iconGrey.image = 'http://www.golfinggreys.com/img/ggmap_icon_services.png'; iconGrey.shadow = ''; iconGrey.iconSize = new GSize(24, 31); iconGrey.shadowSize = new GSize(0, 0); iconGrey.iconAnchor = new GPoint(11, 30); iconGrey.infoWindowAnchor = new GPoint(5, 1); var iconBlue = new GIcon(); iconBlue.image = 'http://www.golfinggreys.com/img/ggmap_icon_shopping.png'; iconBlue.shadow = ''; iconBlue.iconSize = new GSize(24, 31); iconBlue.shadowSize = new GSize(0, 0); iconBlue.iconAnchor = new GPoint(11, 30); iconBlue.infoWindowAnchor = new GPoint(5, 1); var customIcons = []; customIcons["attraction"] = iconPink; customIcons["accomm"] = iconOrange; customIcons["dining"] = iconPurple; customIcons["golf"] = iconGreen; customIcons["golfr"] = iconRed; customIcons["services"] = iconGrey; customIcons["shopping"] = iconBlue; var markerGroups = { "attraction": [], "accomm": [], "dining": [], "golf": [], "golfr": [], "services": [], "shopping": []}; function load() { if (GBrowserIsCompatible()) { var i = 0; // Create the map // Make sure this element has the same ID as your div map = new GMap2(document.getElementById("googlemap")); // Add controls for moving and zooming the map. Use GSmallMapControl for small maps map.addControl(new GSmallMapControl()); // Add controls for switching between regular and satellite views map.addControl(new GMapTypeControl()); // Set the starting position and zoom level when the map loads map.setCenter(new GLatLng(51.920556,-103.798828), 7); // Read the data from XML var request = GXmlHttp.create(); // Open the XML file request.open("GET", "east_central.xml", true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = request.responseXML; // Obtain the array of markers and loop through it var markers = xmlDoc.documentElement.getElementsByTagName("marker"); for (var i = 0; i < markers.length; i++) { // Obtain the attribues of each marker var lat = parseFloat(markers[i].getAttribute("lat")); var lng = parseFloat(markers[i].getAttribute("lng")); var point = new GLatLng(lat,lng); var name = markers[i].getAttribute("name"); var phone = markers[i].getAttribute("phone"); var address = markers[i].getAttribute("address"); var city = markers[i].getAttribute("city"); var state = markers[i].getAttribute("state"); var url = markers[i].getAttribute("url"); var type = markers[i].getAttribute("type"); var marker = createMarker(point,name,phone,address,city,state,url,type); map.addOverlay(marker); } } } request.send(null); // Function to create the marker and set up the event window function createMarker(point,name,phone,address,city,state,url,type) { var marker = new GMarker(point, customIcons[type]); markerGroups[type].push(marker); var markerhtml = ""; if (name != "") markerhtml += "<b>" + name + "</b><br>"; markerhtml += address + ", " + city + ", " + state + "<br>"; if (phone != "") markerhtml += "p:" + phone + "<br>"; if (url != "") markerhtml += "<a href=\"" + url + "\">COURSE DETAILS</a>"; // Add a click event to each marker which will open the HTML window GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(markerhtml); }); i++; return marker; } } // Javascript alert for older browsers where Google Maps isn't supported else { alert("Sorry, the Google Maps API is not compatible with this browser"); } } //]]> THE ADDITION Code: function toggleGroup(type) { for (var i = 0; i < markerGroups[type].length; i++) { var marker = markerGroups[type][i]; if (marker.isHidden()) { marker.show(); } else { marker.hide(); } Just need to properly add that to the end. I am okay at editing and adapting codes, but I don't know the sytax. Tried JSLINT but still confused. Probably quite simple. Thanks Hey all, I was wondering if someone would be able to help me with a problem I've been having. I'm attempting to find coordinates for several addresses at a time. I'm using a for-loop to loop through an array of addresses. I figured it would be best to have a separate function to evaluate the coordinate given an address, and just call it in every loop. Note that my code below is simplified (I removed the for loop because that's not where I'm having trouble). I know that the issue is probably because I'm trying to return a value from an anonymous function... I tried making the variable global, I tried having a return line from within the anonymous function, nothing has worked... any tips? Thanks -- Code follows Code: function initialize(){ var geocoder = new google.maps.Geocoder(); // creating a new geocode object var locCood = findcood('44106', geocoder); } function findcood(addr, geocoder) { var cood; if (geocoder) { geocoder.geocode({'address': addr}, function(results, status, cood){ if (status == google.maps.GeocoderStatus.OK) cood = results[0].geometry.location; else { cood = null; alert("Geocode was not successful for the following reason: " + status); } }); } else { alert("No Geocode"); cood = null; } alert(cood); return cood; } hello all, what i would like to implement is the following : http://mon.grnet.gr/network/maps/lite/?load&ip but, the problem is that, although the numerical data that show the traffic volume passing through a link are available to me, i do not have clue on how i can display them onto the map ... ? i would be thankful, if you could give me a piece of advice. Hey Guys, I am building an application that uses Google Maps V3 and currently using JavaScript to show and hide markers. I have two check boxes, they have the same location but show if a user has been there or if they are going there. To hide the markers, I am doing the following function: Code: function hideMarker(location) { for (var i = 0; i < gmarkers.length; i++) { if (gmarkers[i].currentLocation == location) { gmarkers[i].setVisible(false); } } infowindow.close(); } Problem is, because two markers have the same location, it will hide both. I am passing a been and going value to gmarkers array (gmarkers[i].been etc) so wanted to say something like.. If been is unchecked only hide the been marker. Else if going is unchecked only hide the going marker. Else hide both markers. Anyone have any ideas how I can separate the been and going markers? I can't get my head around the logic Cheers. I started using the Google News Web Element on my website. The website for Google News Web Element is: http://www.google.com/webelements/#!/news I want the links to open in a new window, which cannot be done with the iframe version. Their website only allows me to generate an iframe. I was told that this can be done by using the javascript version, but I have not been able to figure it out. This is their link to the documentation: http://code.google.com/apis/newssearch/newsshow/ I know very little about javascript, and have been trying to get it to work but have been unsuccessful. I want to use the Medium Rectangle size and I want the only topic to be "Swainsboro". The only modification that I want to make is for the links to open in a new window. If anyone can help me do this, it would be appreciated. This is the iframe data that was generated by the wizard: Code: <iframe frameborder=0 marginwidth=0 marginheight=0 border=0 style="border:0;margin:0;width:300px;height:250px;" src="http://www.google.com/uds/modules/elements/newsshow/iframe.html?rsz=large&format=300x250&ned=us&hl=en&q=Swainsboro&element=true" scrolling="no" allowtransparency="true"></iframe> i want to add a not-filled circle at the center of the map and fix it there even user drag and move the map. I tried to add a absolute position div that contain the circle image on the map but obviously it cant do any interaction with the map when clicingk or dragging inside area of the circle because it is just a div but not a part or overlay of the map. then i tried to add a custom overlay on the map, and set the div appended in panes with fixed left and top value, but it seems not work .... so guys, any suggestion? Hello everyone! I've searched a lot of places for a script like this and found nothing. Here's my situation. My site uses a main iframe that changes as you click links. However, Google links to all my pages, I only want it to access a few (because some pages are only meant to be viewed via iframe). I'm looking for a JavaScript that will detect if the page is being viewed in an iframe, if it is, it should take no action, but if it's no, it should redirect to a different page. Is this possible??? i want to draw vector paths on the the google map on my site that I want to add moving vehicles on the roads and i want to zoom the map when the cars going somewhere. Can I do it? I do not want to take a screenshot of the google map adress. here is my javascript codes.Do you have an idea about google map zooming with animations? var options = { controls: { panControl: true, zoomControl: true, mapTypeControl: true, scaleControl: true, streetViewControl: true, overviewMapControl: true }, scrollwheel: true, maptype: 'TERRAIN', markers: [ { latitude: -2.2014, longitude: -80.9763, }, { address: "Guayaquil, Ecuador", html: "My Hometown", icon: { image: "images/gmap_pin_grey.png", iconsize: [26, 46], iconanchor: [12,46] } } ], icon: { image: "http://www.mobilyala.com/mapfiles/marker.png", iconsize: [37, 34], shadowsize: [37, 34], iconanchor: [9, 34], shadowanchor: [19, 34] }, latitude: -2.282, longitude: -80.272, zoom: 10 } Hello chaps, I'm Nick I'm in the process of creating a web app using Google Maps. What the following code should do is retrieve some xml code from a page, then load it on to the map, using the geocoder to get lat/long values from the address. Most of it's just Google code I've mauled about with. The map loads, but none of the markers load on to the map. I've gone to the php page which generates the XML for the markers and all is fine there. I know the code is a messy crock of junk, I was sort of concentrating on trying to make it work then I'll sort out the nomenclature. Bad methodology, I know. Code: var id = null; var adress = null; var image = null; var point = null; var pointer = null; var geocoder = null; var iconBlue = new GIcon(); iconBlue.image = 'http://labs.google.com/ridefinder/images/mm_20_blue.png'; iconBlue.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png'; iconBlue.iconSize = new GSize(12, 20); iconBlue.shadowSize = new GSize(22, 20); iconBlue.iconAnchor = new GPoint(6, 20); iconBlue.infoWindowAnchor = new GPoint(5, 1); var iconRed = new GIcon(); iconRed.image = 'http://labs.google.com/ridefinder/images/mm_20_red.png'; iconRed.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png'; iconRed.iconSize = new GSize(12, 20); iconRed.shadowSize = new GSize(22, 20); iconRed.iconAnchor = new GPoint(6, 20); iconRed.infoWindowAnchor = new GPoint(5, 1); var customIcons = []; customIcons["restaurant"] = iconBlue; customIcons["bar"] = iconRed; function load() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(52.2725, -0.8825), 12); geocoder = new GClientGeocoder(); GDownloadUrl("phpsqlajax_genxml3.php", function(data) { var xml = GXml.parse(data); var markers = xml.documentElement.getElementsByTagName("marker"); for (var i = 0; i < markers.length; i++) { id = markers[i].getAttribute("ID"); address = markers[i].getAttribute("ADDRESS"); image = markers[i].getAttribute("IMAGE"); var point3 = showAddress(address); var marker = createMarker(pointer, id, address, image); map.addOverlay(marker); } }); } } function showAddress(address) { point = geocoder.getLatLng(address,function(point) { if (!point) { alert(address + " not found"); } else { pointer = new GLatLng(point); return pointer; } }); } function createMarker(pointer, id, address, image) { var marker4 = new GMarker(pointer); var html = "<b>" + id + "</b> <br/>" + address + "</b> <br/>" + image; GEvent.addListener(marker, 'click', function() { marker4.openInfoWindowHtml(html); }); return marker4; } Thanks in advance hi all,, actually i used ajax api script.the problem is, the code works well in mozilla and other browser but in IE the dropdown list not showing.. its showing the error google/default+en.I.js line114 (c.g) object not defined.. the code is <script type="text/javascript" src="js/jquery.js"></script> <script src="js/jquery.translate-1.3.7.min.js" type="text/javascript"></script> <script type="text/javascript"> jQuery(function($){ //when DOM is ready $.translate(function(){ //when the Google Language API is loaded function translateTo( destLang ){ //this can be declared in the global scope too if you need it somewhere else $('body').translate( 'english', destLang, { //translate from english to the selected language not: '.jq-translate-ui, .header', //by default the generated element has this className fromOriginal:true //always translate from english (even after the page has been translated) }); } $.translate.ui('select', 'option') .appendTo('#aj') //insert the element to the page .change(function(){ //when selecting another language translateTo( $(this).val() ); return false; //prevent default browser action }); }); }); </script> <div id="aj"></div> Hi All, I'm new to JS, and I'm trying to make google books previewed on my website. It works fine but if the book(ISBN) is not available for previewing, which only gives me nothing on the page What I need is it give me a alert, or some echos,which tells something like "this book is not available for Previewing" when the ISBN is not found. Here is my code used on a php, and also a JS with the link. http://www.google.com/jsapi Quote: <script type="text/javascript" src="js/jsapi.js"></script> <script type="text/javascript"> google.load("books", "0", {"language" : "es-ES"}); function initialize() { var viewer = new google.books.DefaultViewer(document.getElementById('viewerCanvas')); viewer.load('ISBN:<?php echo $ISBN; ?>'); } google.setOnLoadCallback(initialize); </script> </head> <body> <div id="viewerCanvas" style="width: 600px; height: 700px"></div> </body> Hi Guys, This is my first post, apologies in advance. I'm new to javascript and working on a form, for some reason the checkboxes work fine in Google Chrome but ar enot working corectly when using IE. Can anyone put me out of my misery? I've attached the code below Thanks in advance Code: //The Javascript // Functional Code - NO NEED to Change function f40_Disable(f40_par,f40_obj,f40_state){ if (f40_par){f40_clds=f40_AllElements(document.getElementById(f40_par)); } else { f40_clds=f40_AllElements(f40_obj.parentNode); } if (!f40_obj.ary){ f40_obj.ary=new Array(); for (f40_0=0;f40_0<f40_clds.length;f40_0++){ if (f40_clds[f40_0].tagName=='INPUT'||f40_clds[f40_0].tagName=='SELECT'||f40_clds[f40_0].tagName=='TEXTAREA'){ f40_obj.ary[f40_obj.ary.length]=f40_clds[f40_0]; } } } for (f40_1=0;f40_1<f40_obj.ary.length;f40_1++){ f40_obj.ary[f40_1].removeAttribute('disabled'); } if (f40_obj.checked==f40_state){ for (f40_2=0;f40_2<f40_obj.ary.length;f40_2++){ f40_obj.ary[f40_2].setAttribute('disabled','disabled'); } } f40_obj.removeAttribute('disabled'); } function f40_AllElements(f40_){ if (f40_.all){ return f40_.all; } return f40_.getElementsByTagName('*'); } Code: <p><LABEL ACCESSKEY=''><input type='checkbox' name='apps' id='apps[0]' value='BW' onclick="f40_Disable(null,this,false);">BW <input type="text" size="15" maxlength="30" disabled="disabled" name="ShipFirst"> <p><LABEL ACCESSKEY=''><input type='checkbox' name='apps' id='apps[1]' value='Advantage' onclick="f40_Disable(null,this,false);">Advantage <input type="text" size="15" maxlength="30" disabled="disabled" name="ShipLast"> <p><LABEL ACCESSKEY=''><input type='checkbox' name='apps' id='apps[2]' value='MS' onclick="f40_Disable(null,this,false);">MS <input type="text" size="15" disabled="disabled" name="ShipEmail"> <p><LABEL ACCESSKEY=''><input type='checkbox' name='apps' id='apps[3]' value='MOC' onclick="f40_Disable(null,this,false);">MOC <input type="text" size="15" maxlength="30" disabled="disabled" name="ShipCompany"> <p><LABEL ACCESSKEY=''><input type='checkbox' name='apps' id='apps[4]' value='Lk' onclick="f40_Disable(null,this,false);">Lk <input type="text" size="15" maxlength="30" disabled="disabled" name="ShipAddress1"> <p><LABEL ACCESSKEY=''><input type='checkbox' name='apps' id='apps[5]' value='CM' onclick="f40_Disable(null,this,false);">CM <input type="text" size="15" maxlength="30" disabled="disabled" name="ShipAddress2"> <p><LABEL ACCESSKEY=''><input type='checkbox' name='apps' id='apps[6]' value='Ga' onclick="f40_Disable(null,this,false);">Ga <input type="text" size="15" maxlength="30" disabled="disabled" name="ShipCity"> <p><LABEL ACCESSKEY=''><input type='checkbox' name='apps' id='apps[7]' value='Ol' onclick="f40_Disable(null,this,false);">Ol <input type="text" size="15" maxlength="30" disabled="disabled" name="ShipZip"> <p><LABEL ACCESSKEY=''><input type='checkbox' name='apps' id='apps[8]' value='Iy' onclick="f40_Disable(null,this,false);">Iy <input type="text" size="15" maxlength="30" disabled="disabled" name="ShipZip1"> <p><LABEL ACCESSKEY=''><input type='checkbox' name='apps' id='apps[9]' value='TPA' onclick="f40_Disable(null,this,false);">TA <input type="text" size="15" maxlength="30" disabled="disabled" name="ShipZip2"> <p><LABEL ACCESSKEY=''><input type='checkbox' name='apps' id='apps[10]' value='CT' onclick="f40_Disable(null,this,false);">CT <input type="text" size="15" maxlength="30" disabled="disabled" name="ShipZip3"> I havent included the whole script as it's quite long, I'm assuming the problem is somewhere within this section. Thanks. Firstly I know this is a PHP issue yet it is within javascript and IMO is the root cause of the problem. I'm trying to output markers from a search query of locations from my database, onto a Google Map (api v.3) using a tut I found http://tips4php.net/2010/10/use-php-...g-data-on-map/ When adding this to my page I'm getting Undefined index:errors. I have changed the variables in the php part of the script to suit my database yet have left everything else alone, cant figure out why I'm still getting a blank map???? Please help.... My code with errors being shown at bottom; Code: <script src="http://maps.google.com/maps/api/js?v=3&sensor=false" type="text/javascript"></script> <script type="text/javascript"> var icon = new google.maps.MarkerImage("http://maps.google.com/mapfiles/ms/micons/blue.png", new google.maps.Size(32, 32), new google.maps.Point(0, 0), new google.maps.Point(16, 32)); var center = null; var map = null; var currentPopup; var bounds = new google.maps.LatLngBounds(); function addMarker(lat, lng, info) { var pt = new google.maps.LatLng(lat, lng); bounds.extend(pt); var marker = new google.maps.Marker({ position: pt, icon: icon, map: map }); var popup = new google.maps.InfoWindow({ content: info, maxWidth: 300 }); google.maps.event.addListener(marker, "click", function() { if (currentPopup != null) { currentPopup.close(); currentPopup = null; } popup.open(map, marker); currentPopup = popup; }); google.maps.event.addListener(popup, "closeclick", function() { map.panTo(center); currentPopup = null; }); } function initMap() { map = new google.maps.Map(document.getElementById("map"), { center: new google.maps.LatLng(0, 0), zoom: 14, mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeControl: false, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR }, navigationControl: true, navigationControlOptions: { style: google.maps.NavigationControlStyle.SMALL } }); <br /> <b>Notice</b>: Undefined index: name in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>73</b><br /> <br /> <b>Notice</b>: Undefined index: lng in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>75</b><br /> <br /> <b>Notice</b>: Undefined index: info in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>76</b><br /> addMarker(53.994709, ,'<b></b><br/>'); <br /> <b>Notice</b>: Undefined index: name in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>73</b><br /> <br /> <b>Notice</b>: Undefined index: lng in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>75</b><br /> <br /> <b>Notice</b>: Undefined index: info in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>76</b><br /> addMarker(53.985416, ,'<b></b><br/>'); <br /> <b>Notice</b>: Undefined index: name in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>73</b><br /> <br /> <b>Notice</b>: Undefined index: lng in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>75</b><br /> <br /> <b>Notice</b>: Undefined index: info in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>76</b><br /> addMarker(53.985416, ,'<b></b><br/>'); <br /> <b>Notice</b>: Undefined index: name in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>73</b><br /> <br /> <b>Notice</b>: Undefined index: lng in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>75</b><br /> <br /> <b>Notice</b>: Undefined index: info in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>76</b><br /> addMarker(0.000000, ,'<b></b><br/>'); <br /> <b>Notice</b>: Undefined index: name in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>73</b><br /> <br /> <b>Notice</b>: Undefined index: lng in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>75</b><br /> <br /> <b>Notice</b>: Undefined index: info in <b>D:\www\ofcftp\familysupport-results.php</b> on line <b>76</b><br /> addMarker(0.000000, ,'<b></b><br/>'); center = bounds.getCenter(); map.fitBounds(bounds); } </script> |