On Jan 25, 6:59 am, onlydesigning <[email protected]> wrote: > > I need URGENT help getting this to work.
Urgent again? I still don't think so. You better read this carefully: http://catb.org/~esr/faqs/smart-questions.html#urgent -- Marcelo - http://maps.forum.nu -- > Here is the code and I simply need > to know what to change to make this work. I left the key section out... > > <script language="JavaScript" type="text/javascript"> > <!-- > if (document.images) { > homebuttonon = new Image(); > homebuttonon.src = "images/HomeOn.jpg" ; > homebuttonoff = new Image() ; > homebuttonoff.src = "images/HomeOff.jpg" ; > > aboutbuttonon = new Image(); > aboutbuttonon.src = "images/AboutOn.jpg" ; > aboutbuttonoff = new Image() ; > aboutbuttonoff.src = "images/AboutOff.jpg" ; > > contactsbuttonon = new Image(); > contactsbuttonon.src = "images/ContactsOn.jpg" ; > contactsbuttonoff = new Image() ; > contactsbuttonoff.src = "images/ContactsOff.jpg" ; > > placesbuttonon = new Image(); > placesbuttonon.src = "images/PlacesOn.jpg" ; > placesbuttonoff = new Image() ; > placesbuttonoff.src = "images/PlacesOff.jpg" ; > > ratesbuttonon = new Image(); > ratesbuttonon.src = "images/RatesOn.jpg" ; > ratesbuttonoff = new Image() ; > ratesbuttonoff.src = "images/RatesOff.jpg" ; > } > function butttonOn( buttonname ) { > if (document.images) { > document[ buttonname ].src = eval( buttonname + "on.src" ); > } > } > function butttonOff ( buttonname ) { > if (document.images) { > document[ buttonname ].src = eval( buttonname + "off.src" ); > } > } > // --> > > </script> > <script type="text/javascript"> > var geocoder, location1, location2, gDir; > > function initialize() { > geocoder = new GClientGeocoder(); > gDir = new GDirections(); > GEvent.addListener( > gDir, "load", function() { > var resultTable; > var drivingDistanceMiles = parseInt(gDir.getDistance().meters / > 160.9344)/10; > var drivingTaximeter = (drivingDistanceMiles * 2.5) + 2; > > resultTable = '<table border="0" cellpadding="2" > cellspacing="0" align="center">'; > resultTable += ' > <tr><td colspan="2" style="border-left:1px solid #FFFF99;border-top:1px > solid #FFFF99;border-right:1px solid #FFFF99;font-family: New Times Roman; > font-size: 12pt;">Origin / Pick-up: '; > resultTable += location1.address; > resultTable += '</td></tr> > <tr><td align="center" style="border-left:1px solid #FFFF99;border-top:1px > solid #FFFF99;border-right:1px solid #FFFF99;border-bottom:1px solid > #FFFF99;font-family: New Times Roman; font-size: 12pt;">Latitude: '; > resultTable += location1.lat; > resultTable += '</td><td align="center" style="border-top:1px > solid #FFFF99;border-right:1px solid #FFFF99;border-bottom:1px solid > #FFFF99;font-family: New Times Roman; font-size: 12pt;">Longitude: '; > resultTable += location1.lon; > resultTable += '</span></td></tr> > '; > resultTable += ' > <tr><td colspan="2"> </td></tr> > '; > resultTable += ' > <tr><td colspan="2" style="border-left:1px solid #FFFF99;border-top:1px > solid #FFFF99;border-right:1px solid #FFFF99;font-family: New Times Roman; > font-size: 12pt;">Destination / Drop-off: '; > resultTable += location2.address; > resultTable += '</td></tr> > <tr><td align="center" style="border-left:1px solid #FFFF99;border-top:1px > solid #FFFF99;border-right:1px solid #FFFF99;border-bottom:1px solid > #FFFF99;font-family: New Times Roman; font-size: 12pt;">Latitude: '; > resultTable += location2.lat; > resultTable += '</td><td align="center" style="border-top:1px > solid #FFFF99;border-right:1px solid #FFFF99;border-bottom:1px solid > #FFFF99;font-family: New Times Roman; font-size: 12pt;">Longitude: '; > resultTable += location2.lon; > resultTable += '</span></td></tr> > </table> > <br><span style="font-family: New Times Roman; font-size: > 12pt;">Approximately:</span><br>'; > resultTable += '<div align="center" style="font-family: New > Times Roman; font-size: 18pt; font-weight: bold;"> > Taximeter Fare: '; > resultTable += drivingTaximeter + '</div> > '; > resultTable += '<div align="center" style="font-family: New > Times Roman; font-size: 18pt; font-weight: bold;"> > Miles Travelled: '; > resultTable += drivingDistanceMiles + ' miles</div> > '; > > document.getElementById('results').innerHTML = resultTable; > > // document.getElementById('results').innerHTML = '<strong>Origin > / Pick-up: </strong>' + location1.address + ' (<strong>Latitude: </strong>' > + location1.lat + ' / <strong>Longitude: </strong>' + location1.lon + ')<br > /><strong>Destination / Drop-off: </strong>' + location2.address + ' > (<strong>Latitude: </strong>' + location2.lat + ' / <strong>Longitude: > </strong>' + location2.lon + ')<br /><strong>Taximeter Fare: $</strong>' + > drivingTaximeterLow + ' to $' + drivingTaximeterHigh + '<br > /><strong>Driving Distance: </strong>' + drivingDistanceMiles + ' miles (or > ' + drivingDistanceKilometers + ' kilometers)'; > } > ); > } > > function showLocation() { > geocoder.getLocations( > document.forms[0].address1.value, function (response) { > if (!response || response.Status.code != 200) { > alert("Sorry, we were unable to find the first address"); > } else { > location1 = {lat: response.Placemark[0].Point.coordinates[1], > lon: response.Placemark[0].Point.coordinates[0], address: > response.Placemark[0].address}; > geocoder.getLocations( > document.forms[0].address2.value, function (response) { > if (!response || response.Status.code != 200) { > alert("Sorry, we were unable to find the second > address"); > } else { > location2 = {lat: > response.Placemark[0].Point.coordinates[1], lon: > response.Placemark[0].Point.coordinates[0], address: > response.Placemark[0].address}; > gDir.load('from: ' + location1.address + ' to: ' + > location2.address); > } > } > ); > } > } > ); > } > > //<iframe width="425" height="350" frameborder="0" scrolling="no" > marginheight="0" marginwidth="0" > src="http://maps.google.com/maps?f=d&source=s_d&saddr=BWI+Airport&..."></iframe><br/><small><a > href="http://maps.google.com/maps?f=d&source=embed&saddr=BWI+Airpor..." > style="color:#0000FF;text-align:left">View Larger Map</a></small> > > </script> > > <br /> > <table align="center" border="0" cellpadding="0" cellspacing="0" > id="pagetable"> > <tbody> > <tr> > > <form action="#" onsubmit="showLocation(); return false;"> > </form> > </tr> > </tbody></table> > <table align="center" border="0" cellpadding="0" cellspacing="2"> > <tbody> > <tr> > <td align="center" colspan="2" style="font-family: New Times > Roman; font-size: 12pt;">Use the following form to calculate you cab fare > between two places.<br /> > Please note this form is only as accurate as the distances supplied by > Google.<br /> > </td> > </tr> > <tr> > <td align="right" style="font-family: New Times Roman; font-size: > 12pt; font-weight: bold;">Origin / Pick-up: </td> > <td><input name="address1" size="40" type="text" value="" /></td> > </tr> > <tr> > <td align="right" style="font-family: New Times Roman; font-size: > 12pt; font-weight: bold;">Destination / Drop-off: </td> > <td><input name="address2" size="40" type="text" value="" /></td> > </tr> > <tr> > > <td><a href="http://maps.google.com/"><img border="0" > src="http://www.secform4.com/images/powered_by_google.gif" /></a></td> > <td align="right"><input type="submit" value="Calculate" /></td> > </tr> > </tbody></table> > <br /> > <div id="results"> > </div> -- You received this message because you are subscribed to the Google Groups "Google Maps API V2" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
