JavaScript - Troubleshooting Google Map Code
Hi,
I need to determine how to fix a Google map script and I cannot figure out how. I'm new to adding Google maps to a web page, so I need help. I searched Google Maps website and still cannot figure it out. I'm under a tight deadline to complete by Monday. Could someone please tell me what code changes I need to make to fix it? I'd really appreciate it. Below are the javascripts and further below is the div tag to display the map. <html> <head> <title>Broken Map</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script src="../js/scriptaculous-js-1.8.1/lib/prototype.js" type="text/javascript"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> <script type="text/javascript"> $("item1").style.backgroundColor="red"; var map; var resultsLayer; function initialize() { var originalcenter = new google.maps.LatLng(37.875696,-95.624207); var myOptions = { zoom: 4, center: originalcenter, mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map"), myOptions); resultsLayer = new google.maps.FusionTablesLayer({ suppressInfoWindows: false, query: { from: '1008134', select: 'Location' } }); resultsLayer.setMap(map); } </script> </head> <body> <div id="map"></div> </body> </html> Similar Tutorialsi have code to create a select list. this select list is populated by db query i have two pieces of code i need looked at to fix the problem Code: echo "<select name='LearnedJutsus' id='YourJutsu' onchange='return jutsu()' >"; foreach($learnedJutsuInfo as $v) { echo "<option value='$v'>$v</option>"; } echo "</select></form>"; and most importantly this one! Code: var selection=document.getElementById("x").options[document.getElementById("x").selectedIndex].value; i did not write the above code it was donated to me but it seems to be not working correctly. what i need is an explanation on how it works (which would be best since im foggy with jscript)or a fix for it i basically need it to grab the selected option's information for later use in the program. this is a pivotal part of the system any help appreciated. Hi, I'm making a javascript with google maps API. The concept is that you have to fill in your desired location and that it shows you the route to that location. It has an unchangeable starting location. I also made it so that you have a description panel. Now when I try to make it so that the description panel is next to the map with the route on, my description panel just drops below my map. I believe this problem is either me f*cking up my div's or my CSS. Here's what i used for my CSS <style type="text/css"> html, body { height: 100%; margin: 0; padding: 0; } #map_canvas { height: 100%; width: 70% } #directionsPanel { float:right; width:30%; height 100% } @media print { html, body { height: auto; } #map_canvas { height: 650px; } } </style> And here's what i used for my div's <div id="main" style="width:100%;height:100%"> <div id="map_canvas" style="top:30px;width:70%;height:80%"></div> <div id="warnings_panel" style="width:100%;height:10%;text-align:center"></div> <div id="directionsPanel" style="float:right;width:30%;height 100%"></div> </div> Any help regarding this would be much appreciated. (And yes, I'm still new to scriptwriting/coding in general) anyone else have issues with their code messing up their page view-ability in Safari on a Mac? thanks! HI, I am not a programmer. however, i am working with a website wherein on its registration page there is this text box to enter the name. No for example if I have to enter my name as John Smith it does not allow as it is validated in a way that it does not allow the space. Now my web development agency is charging a bomb to revalidate just that one text box. can someone help me with the coding or steps involved to validate this text box. And howmuch time will it take. 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 this code works in google chrome, but not in firefox. Code: function merge(obj1, obj2) { var a ={}; for (var p in obj1) { try { // Property in destination object set; update its value. if ( obj1[p].constructor==Object ) { a[p] = merge(a[p], obj1[p]); } else { a[p] = obj1[p]; } } catch(e) { // Property in destination object not set; create it and set its value. a[p] = obj1[p]; } } for (var p in obj2) { try { // Property in destination object set; update its value. if ( obj2[p].constructor==Object ) { a[p] = merge(a[p], obj2[p]); } else { a[p] = obj2[p]; } } catch(e) { // Property in destination object not set; create it and set its value. a[p] = obj2[p]; } } return a; } var d=function(){'c';} var a ={a:{b:'c'},b:'c'} var b ={c:a,d:d}; var c = merge(window,b); WHY?!?!?!?!?!?!?!?!?!?!?!?!??!?!?!?! I have the google analytics code but it is presenting itself as not valid. Code: <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try{ var pageTracker = _gat._getTracker("UA-xxxxxx-x"); pageTracker._trackPageview(); } catch(err) {} </script> Can anyone help? ALso is this script suitable to link to externally? I have put this together and it looks to me like it should work but when i ht submit it does nothing, no error or anything, which makes it hard for me to diagnose. You all are much more experienced minds and may look at it and see my error right away (at least thats what im hoping) the point of this project is a form that will post(including pics) to a google spreadsheet. it may be i need to post this in the ajax forum, but its at least partially js so let me know thank you so much for your help all Code: <!DOCTYPE html> <html> <head> <title>QC Observation</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> </head> <body> <div> <form id="form" target="_self" onsubmit="" action=""> <div class="ss-header-image-container"><div class="ss-header-image-image"><div class="ss-header-image-sizer"></div></div></div> <div class="ss-top-of-page"><div class="ss-form-heading"><h1 class="ss-form-title" dir="ltr">QC Observation</h1> <div class="ss-form"><form action="https://docs.google.com/forms/d/1jkIpSFH16SiNlsj13cBBRsuoiXmqeGVAI6PttCQiff8/formResponse" method="POST" id="ss-form" target="_self" onsubmit=""><ol role="list" class="ss-question-list" style="padding-left: 0"> <div class="ss-form-question errorbox-good" role="listitem"> <div dir="ltr" class="ss-item ss-item-required ss-select"><div class="ss-form-entry"> <label class="ss-q-item-label" for="entry_1344879795"><div class="ss-q-title">Bldg <label for="itemView.getDomIdToLabel()" aria-label="(Required field)"></label> <span class="ss-required-asterisk" aria-hidden="true">*</span></div> <div class="ss-q-help ss-secondary-text" dir="ltr"></div></label> <select name="entry.1344879795" id="entry_1344879795" aria-label="Bldg " aria-required="true" required=""><option value=""></option> <option value="A Residence">A Residence</option> <option value="B Residence">B Residence</option> <option value="C Residence">C Residence</option> <option value="D Residence">D Residence</option> <option value="OSB">OSB</option> <option value="MNT">MNT</option> <option value="TWB">TWB</option> <option value="VP">VP</option> <option value="VM">VM</option> <option value="Site Dev">Site Dev</option></select> <div class="required-message">This is a required question</div></div></div></div> <div class="ss-form-question errorbox-good" role="listitem"> <div dir="ltr" class="ss-item ss-item-required ss-select"><div class="ss-form-entry"> <label class="ss-q-item-label" for="entry_1358292836"><div class="ss-q-title">QC Representative <label for="itemView.getDomIdToLabel()" aria-label="(Required field)"></label> <span class="ss-required-asterisk" aria-hidden="true">*</span></div> <div class="ss-q-help ss-secondary-text" dir="ltr"></div></label> <select name="entry.1358292836" id="entry_1358292836" aria-label="QC Representative " aria-required="true" required=""><option value=""></option> <option value="David Bradley">David Bradley</option> <option value="Ryan Harper">Ryan Harper</option> <option value="Herschell Mirick">Herschell Mirick</option> <option value="Bill Bejelis">Bill Bejelis</option> <option value="Nick Pappas">Nick Pappas</option> <option value="Stephen Gehrlich">Stephen Gehrlich</option> <option value="Beth Davis">Beth Davis</option> <option value="Ohene Akrofi">Ohene Akrofi</option> <option value="Mike Dow">Mike Dow</option> <option value="David Picknell">David Picknell</option> <option value="Lynne Viescas">Lynne Viescas</option></select> <div class="required-message">This is a required question</div></div></div></div> <div class="ss-form-question errorbox-good" role="listitem"> <div dir="ltr" class="ss-item ss-item-required ss-select"><div class="ss-form-entry"> <label class="ss-q-item-label" for="entry_895392494"><div class="ss-q-title">Shop Responsible <label for="itemView.getDomIdToLabel()" aria-label="(Required field)"></label> <span class="ss-required-asterisk" aria-hidden="true">*</span></div> <div class="ss-q-help ss-secondary-text" dir="ltr"></div></label> <select name="entry.895392494" id="entry_895392494" aria-label="Shop Responsible " aria-required="true" required=""><option value=""></option> <option value="Walls/Ceilings">Walls/Ceilings</option> <option value="Plumbing">Plumbing</option> <option value="Electrical">Electrical</option> <option value="HVAC/Sheet Metal">HVAC/Sheet Metal</option> <option value="Carpentry">Carpentry</option> <option value="Interiors">Interiors</option> <option value="Exteriors">Exteriors</option> <option value="Masonry">Masonry</option> <option value="Mechanics">Mechanics</option> <option value="Structural">Structural</option></select> <div class="required-message">This is a required question</div></div></div></div> <div class="ss-form-question errorbox-good" role="listitem"> <div dir="ltr" class="ss-item ss-select"><div class="ss-form-entry"> <label class="ss-q-item-label" for="entry_1493538421"><div class="ss-q-title">Issue Type </div> <div class="ss-q-help ss-secondary-text" dir="ltr"></div></label> <select name="entry.1493538421" id="entry_1493538421" aria-label="Issue Type "><option value=""></option> <option value="Poor Workmanship">Poor Workmanship</option> <option value="Lack of Training">Lack of Training</option> <option value="Not Per Plans">Not Per Plans</option> <option value="Not Per Code">Not Per Code</option> <option value="Not Per Spec">Not Per Spec</option> <option value="Plan Conflict">Plan Conflict</option></select> <div class="required-message">This is a required question</div></div></div></div> <div class="ss-form-question errorbox-good" role="listitem"> <div dir="ltr" class="ss-item ss-paragraph-text"><div class="ss-form-entry"> <label class="ss-q-item-label" for="entry_177485091"><div class="ss-q-title">Notes/Actions </div> <div class="ss-q-help ss-secondary-text" dir="ltr"></div></label> <textarea name="entry.177485091" rows="8" cols="0" class="ss-q-long" id="entry_177485091" dir="auto" aria-label="Notes/Actions "></textarea> <div class="error-message" id="754075454_errorMessage"></div> <div class="required-message">This is a required question</div> </div></div></div> <div class="ss-form-question errorbox-good" role="listitem"> <div dir="ltr" class="ss-item ss-item-required ss-date"><div class="ss-form-entry"> <label class="ss-q-item-label" for="entry_1875356531"><div class="ss-q-title">Follow-Up Date <label for="itemView.getDomIdToLabel()" aria-label="(Required field)"></label> <span class="ss-required-asterisk" aria-hidden="true">*</span></div> <div class="ss-q-help ss-secondary-text" dir="ltr"></div></label> <input type="date" name="entry.1875356531" value="" class="ss-q-date" dir="auto" id="entry_1875356531" aria-label="Follow-Up Date " aria-required="true" required=""> <div class="required-message">This is a required question</div></div></div></div> <input type="hidden" name="draftResponse" value="[,,"3618330731406970920"] "> <input type="hidden" name="pageHistory" value="0"> <input type="hidden" name="fbzx" value="3618330731406970920"> <tr> <td>Image File</td> <td> <input type="file" name="uploadedFile" class="gwt-FileUpload"> </td> </ol></div> <div style="width: 100%; display: block; float: right;"> <button id="send" type="submit"> Send </button> </div> </form> </div> <script type="text/javascript"> function postToGoogle() { var field1 = $("input[type='radio'][name='qs1']:checked").val(); var field2 = $("input[type='radio'][name='qs2']:checked").val(); var field3 = $('#feed').val(); $.ajax({ url: "https://docs.google.com/forms/d/1jkIpSFH16SiNlsj13cBBRsuoiXmqeGVAI6PttCQiff8/formResponse", data: {"entry.1023121230": field3, "entry.1230072460": field1, "entry.2113237615": field2}, type: "POST", dataType: "xml", statusCode: { 0: function() { //Success message }, 200: function() { //Success Message } } }); } $(document).ready(function(){ $('#form').submit(function() { postToGoogle(); return false; }); }); </script> </body> </html> Reply With Quote 01-27-2015, 10:10 AM #2 Dormilich View Profile View Forum Posts Senior Coder Join Date Jan 2010 Location Behind the Wall Posts 3,532 Thanks 13 Thanked 372 Times in 368 Posts first you should verify whether your AJAX actually sends something off: open the browser’s dev tools and check the network panel for any outgoing requests. I might as well mention the SOP (same origin policy) here that governs which URLs you are allowed to contact. Hello, I'm having a TypeError problem. Basically I've got scripts which seem to work fine and don't spit out any errors. There is a contact page... which has a form, and on clicking submit... you can sent to another page generated with a php header and footer and then some custom info based on if you filled everything out correctly or not. In any event, when you get sent to this page it's not really showing up because of some TypeError from the same script that works everywhere else and I can't figure it out. It's specific to the following js. Code: (evaluating 'nav_toggle.addEventListener') which is in the following function Code: // nav toggle function initNavToggle() { // classie toggle var nav = document.querySelector('nav.nav-main'), nav_toggle = document.querySelector('a.nav-toggle'); nav_toggle.addEventListener('click', function(e){ e.preventDefault(); classie.toggle(nav, 'open'); classie.toggle(nav_toggle, 'toggle-back'); }); // toggle burger switch document.querySelector( '.nav-toggle' ).addEventListener( 'click', function() { this.classList.toggle( 'active' ); }); } which pertains to the following html Code: <a href="#" class="nav-toggle">Menu</a> <nav class="nav-main"> <ul> <li><a href="/">A</a></li> <li><a href="/">B</a></li> <li><a href="/">C</a></li> <li><a href="/">D</a></li> </ul> </nav> Is it possible that because the nav html is in the header and being assembled via php that the script is firing before the html exists? Reply With Quote 01-09-2015, 09:56 PM #2 wyclef View Profile View Forum Posts Regular Coder Join Date Feb 2005 Posts 239 Thanks 9 Thanked 0 Times in 0 Posts Well, I guess I just answered my own question because I tried taking the script from the footer and putting it in the header and now everything works. Not understanding what is going on here really. Using FormM@iler | LAMP Application Developer, UI/UX, SEO PHP FormM@iler. Guess hold off looking at this until I examine things further. Reply With Quote 01-09-2015, 10:29 PM #3 Old Pedant View Profile View Forum Posts Supreme Master coder! Join Date Feb 2009 Posts 28,311 Thanks 82 Thanked 4,754 Times in 4,716 Posts The code inside a function can't fire until the function is invoked. So where is the function invoked? Where does classie come from? You don't show it. I'm new to the forum. So hi everyone. The code below works fine on IE and FF but not on Google Chrome. Can someone tell me where I'm doing wrong? Thank you for your answers in advance. Im really looking forward much to hearing from you. You can preview the below code by pasting it to Frontpage, Dreamweaver and etc. Quote: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/JavaScript"> <!-- function show(id) { if (document.getElementById(id).style.display == 'none') { document.getElementById(id).style.display = ''; } } //--> <!-- function hide(id) { document.getElementById(id).style.display = 'none'; } //--> </script> </head> <body> <div> <div> <table cellspacing="1" cols="3" border="0"> <tbody> <td><a onfocus="hide('tblB');hide('tblC');show('tblA');" href="#">A</a> <td><a onfocus="hide('tblA');hide('tblC');show('tblB');" href="#">B</a> <td><a onfocus="hide('tblB');hide('tblA');show('tblC');" href="#">C</a> </td> </tr> </tbody> </table> </div> <div> <table id="tblA" style="DISPLAY: none" cols="1" cellpadding="2"> <tbody> <tr valign="top" align="left"> <td> You select A, table tblA is shown </td> </tr> </tbody> </table> </div> <div> <table id="tblB" style="DISPLAY: none" cols="1" cellpadding="2"> <tbody> <tr valign="top" align="left"> <td> You select B, table tblB is shown </td> </tr> </tbody> </table> </div> <div> <table id="tblC" style="DISPLAY: none" cols="1" cellpadding="2"> <tbody> <tr valign="top" align="left"> <td> You select C, table tblC is shown </td> </tr> </tbody> </table> </div> </div> </body> </html> I have a page with a GoogleMap with a GoogleBar and I would like the GoogleBar to appear with something written in it already and to have that search executed. In other words, I would like to "write something to the GoogleBar and press Enter" automatically as soon as the map loads. How can I do this? btw: By GoogleBar, I mean the search bar that appears on the map after using the enableGoogleBar() function. First of all, I read the rules regarding how to post a question on the forums, and I couldn't think of a much better description, so I hope thats okay. My problem is this, I am using a simple code (Posted Below) that creates a drop-down menu containing a list of languages, when any of these languages are clicked it sends the user to Google translate to automatically convert the text. The code works fine, but now Im realizing I have no way of knowing which languages are chosen and how often. I have tried linking it to my Google Analytics but to no avail. The only solution I can think of is to send the user to maybe a PHP file that then redirects them to the Google translate page, so I can monitor it by viewing how many times the redirect page was viewed. I already use this redirect technique to track how many users follow my links to external downloads, so I know its probable. But my real question is how would I go about sending the user to a redirect page? I'm a novice web developer by the way. I'm thinking I would have to send the variable containing language to the redirect, along with a variable containing the URL to be translated, and then have the redirect input the data same as the original form. But even if this is possible, I don't know how to go about it. Any help would be greatly appreciated. Quote: <select name="translate" style="height:18px; font-size:10px;" onchange="javascript:window.location = 'http://www.google.com/translate_c?hl=en&langpair=en%7C' + this.value + '&u=' + window.location.href;"> <option value="">Translate This Page</option> <option value="ar">Arabic</option> ...LIST OF OTHER LANGUAGES <option value="es">Spanish</option> </select> Hi, I'm not sure where I have translated this incorrectly. I have one google map embedded on my page which works fine. But I wanted to add a second one. I thought the easiest way to do this would be to have a second page which is called later on with all the details on it for the second map. However although I think (this I presume is where I went wrong) I have replicated the instructions correctly the place holder for the second map just remains blank. This is the code for my called page with the instructions for the second map: PHP Code: <?php echo $_POST['Map'] . '<br />'; ?> <div id="placemap_canvas"></div> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <style type="text/css"> html {height:250px} body {height:250px} #placemap_canvas {width:100%; height:150px;} </style> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true" /> </script> <script type="text/javascript"> var latlng = new google.maps.LatLng ( <?php include("dbconnect.php"); $result = mysql_query("SELECT * FROM regions WHERE RegionPId='{$_POST['Map']}'"); while($row = mysql_fetch_array($result)){ echo $row['maplink']; } mysql_close($con); ?> ); var myOptions = { zoom: 4, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("placemap_canvas"), myOptions); } </script> And this is the script of the main page, just in case I would be better off keeping them both in one place. Code: <head> <script type="text/javascript"> function loadSubPlace(File,ID,Msg,Eile,EID,Esg){ loadXMLDoc1(File,ID,Msg); var mimer = setTimeout(function(){loadXMLDoc1(Eile,EID,Esg)},5000); } </script> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <style type="text/css"> html {height:250px} body {height:250px} #map_canvas {width:30%; height:250px;} </style> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true" /> </script> <script type="text/javascript"> function initialize() { var latlng = new google.maps.LatLng ( <?php include("dbconnect.php"); $result = mysql_query("SELECT * FROM countries WHERE Country='{$_SESSION['Country']}'"); while($row = mysql_fetch_array($result)){ echo $row['Map']; } mysql_close($con); ?>); var myOptions = { zoom: 4, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); } </script> </head> <body onload="initialize()"> <div class="countryright" id="map_canvas"> include("dbconnect.php"); $snowball=explode(';',$_POST['syringa']); $turnsol=$snowball[1]; $violet =$snowball[2]; $wakerobin=$snowball[3]; global $turnsol; global $violet; global $wakerobin; echo '<center><b><big>' . $wakerobin. '</big></b></center><br /><br />'; $result=mysql_query("SELECT * FROM regions WHERE country='{$turnsol}' AND region='{$violet}' AND place='{$wakerobin}' AND sub !='' ORDER BY sub ASC"); while($row = mysql_fetch_array($result)){ $wheat="{$row['RegionPId']};{$turnsol};{$violet};{$wakerobin};{$row['sub']}"; $tigerlilly=$row['RegionPId']; echo '<input type="button" class="button3" name="place" id="place" value="' . $row['sub'] . '" onclick="loadSubPlace(\'getPlace.php\',\'txtHintPlaceSub\',\'hepatica=' . urlencode($wheat) . '\',\'getPlaceMap.php\',\'placemapcanvas\',\'Map=' . urlencode($tigerlilly) . '\');" />'; } echo '<input type="button" class="button3" name="addplace" id="addplace" value="Add Place" onclick="loadXMLDoc1(\'getAddPlaceSub.php\',\'txtHintPlaceSub\', encodeURI(\'addsubplace=' . $_POST['syringa'] . '\'));" />'; echo '<br /><br /><div id="txtHintPlaceSub"></div><br /><br />'; mysql_close($con); ?> I've cut out the script that doesn't relate to this so I hope I haven't missed anything important. Can the Google API replace scraping? You can get blocked by Google if you scrape, but can you get the same info from the Google API at no risk?
This post will contain a few guidelines for what you can do to get better help from us. Let's start with the obvious ones: - Use regular language. A spelling mistake or two isn't anything I'd complain about, but 1337-speak, all-lower-case-with-no-punctuation or huge amounts of run-in text in a single paragraph doesn't make it easier for us to help you. - Be verbose. We can't look in our crystal bowl and see the problem you have, so describe it in as much detail as possible. - Cut-and-paste the problem code. Don't retype it into the post, do a cut-and-paste of the actual production code. It's hard to debug code if we can't see it, and this way you make sure any spelling errors or such are caught and no new ones are introduced. - Post code within code tags, like this [code]your code here[/code]. This will display like so: Code: alert("This is some JavaScript code!") - Please, post the relevant code. If the code is large and complex, give us a link so we can see it in action, and just post snippets of it on the boards. - If the code is on an intranet or otherwise is not openly accessible, put it somewhere where we can access it. - Tell us any error messages from the JavaScript console in Firefox or Opera. (If you haven't tested it in those browsers, please do!) - If the code has both HTML/XML and JavaScript components, please show us both and not just part of it. - If the code has frames, iframes, objects, embeds, popups, XMLHttpRequest or similar components, tell us if you are trying it locally or from a server, and if the code is on the same or different servers. - We don't want to see the server side code in the form of PHP, PERL, ASP, JSP, ColdFusion or any other server side format. Show us the same code you send the browser. That is, show us the generated code, after the server has done it's thing. Generally, this is the code you see on a view-source in the browser, and specifically NOT the .php or .asp (or whatever) source code. Is there a javascript that when I mouse over a object like the the magnifying glass that can be seen after a google search that will display a preview image and then make that image clickable to pull up that webpage/file? TYIA James Hey I need some advice about Google translate, basically if you go to http://translate.google.com/#en|ja|Hello%20world and hover your mouse over the Japanese writing you will see it glow yellow ant allows you to click it to switch the text to something else to turn the string into the correct translation. What I want advice with is when I use the Google translate API am I able to obtain that list and output them onto my page. For example if a user writes in a textbox "Hello World" I want the API to return the list of possible translations for that string, something like this. Code: Language 1: en Language 2: ja String: Hello World ## Splits the string up by it's words -- Start Hello 1. こんにちは - Hi 2. ハロー - Halo 3. 挨拶 - Greeting 4. 投稿 - Posts World 1. 、世界 - World 2. 世界 - World 3. 世界の - World 4. 世界中 - Worldwide 5. の世界 - World ## Splits the string up by it's words -- End ## Uses each translated word to build a final list with all possible outcomes Hello World - (all possible outcomes) 1. こんにちは、世界 - Hello World 2. こんにちは世界 - Hello World 3. こんにちは世界の - Hello World 4. こんにちは世界中 - Hello world 5. こんにちはの世界 - Hello World 6. ハロー、世界 - Hello World 7. ハロー世界 - Hello World 8. ハロー世界の - Hello World 9. ハロー世界中 - Hello world 10. ハローの世界 - Hello World 11. 挨拶、世界 - Greetings, world 12. 挨拶世界 - Greetings the World 13. 挨拶世界の - Greetings World 14. 挨拶世界中 - Greetings Worldwide 15. 挨拶の世界 - Greetings World 16. 投稿、世界 - Post World 17. 投稿世界 - Post World 18. 投稿世界の - Post World 19. 投稿世界中 - Posts Worldwide 20. 投稿の世界 - Post World ## The final array that will be used for printing to the page. ## Only these have been chosen because the string equals the ## same but also the capital letters are the same as well. 1. こんにちは、世界 - Hello World 2. こんにちは世界 - Hello World 3. こんにちは世界の - Hello World 4. こんにちはの世界 - Hello World 5. ハロー、世界 - Hello World 6. ハロー世界 - Hello World 7. ハロー世界の - Hello World 8. ハローの世界 - Hello World How can I do this, with or without the use of Google's API???? Hi, Can anyone help define the difference between the 2 scripts below and help identify what is/should happen for each? Code: <script type="text/javascript"> var _gaq = _gaq || []; //NHG COMMENT: if there is an existing account, then it needs to be incorporated within this tag. //The xx-xxxx-x par represents the google account code that needs to be inserted // if there is no existing tag in place, then take out the 2 follwoing lines marked (1) and (2)and (3) (1) _gaq.push(['_setAccount', 'XX-XXXXXX-X']); (2) _gaq.push(['_setDomainName', 'MYSUBDOMAIN.domain.com']); (3) _gaq.push(['_trackPageview']); NHG COMMENT: This is the global tag and everything below this MUST NOT BE CHANGED _gaq.push(['_setAccount', UA-16522538-1']); _gaq.push(['_setDomainName', 'domain.com']); _gaq.push(['_setAllowLinker', true]); _gaq.push(['_trackPageview']); (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> Code: // copy and paste the tag below <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'XX-XXXXXX-X']); _gaq.push(['_setDomainName', 'MYSUBDOMAIN.domain.com']); _gaq.push(['_trackPageview']); _gaq.push(['_setAccount', UA-16522538-1']); _gaq.push(['_setDomainName', 'domain.com']); _gaq.push(['_setAllowLinker', true]); _gaq.push(['_trackPageview']); (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> 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??? Hi there, I know too little of JavaScript to get the Google Maps API working. I hope someone can help me out! My goal is to display an address. In the example on google, you can input it through a form: http://code.google.com/apis/maps/doc...ng-simple.html I would like the map to show the location+marker when I open the page, not after clicking a submit button. However, I only want an address in my html. I want the API to convert it in a LatLng format. Hopefully, someone can take the time to look at it. It's all in the source code of the page mentioned above, I believe. Thanks! |