I have a script that uses the google maps geocoder and a html form to pass the javascript variable so to perl. Now all of this seems to work fine in mozilla firefoz and internet explorer but seems to fail when used on an apple mac.
This is a sample of the code:
Expand|Select|Wrap|Line Numbers
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
- <title>Welcome to the Lothian Buses Dynamic Route Selector</title>
- <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA0j3m7rlEW8A2mxzuyAzXrRQ6jALPQpIWZWNXAFq4N3n_zdAATRSXIi4bVnf99msiXGgcZ9wmNmvEzA"
- type="text/javascript"></script>
- <script type="text/javascript">
- //<![CDATA[
- var map;
- var geocoder = null;
- var addressMarker;
- var originpoint = null;
- var destinationpoint = null;
- function load() {
- if (GBrowserIsCompatible()) {
- map = new GMap2(document.getElementById("map"));
- map.addControl(new GSmallMapControl());
- map.addControl(new GMapTypeControl());
- map.setCenter(new GLatLng(55.950254, -3.187606), 10);
- geocoder = new GClientGeocoder();
- }
- }
- function showAddress(address) {
- if (geocoder) {
- geocoder.getLatLng(address,
- function(point1) {
- if (!point1) {
- alert(address + " not found");
- } else {
- if (addressMarker) {
- map.removeOverlay(addressMarker);
- }
- addressMarker = new GMarker(point1);
- map.setCenter(point1, 15);
- map.addOverlay(addressMarker);
- originpoint = point1;
- }
- }
- );
- }
- }
- function setVars()
- {
- document.getElementById('orig').value = originpoint;
- return true;
- }
Expand|Select|Wrap|Line Numbers
- <form action="#" onsubmit="showAddress(this.address.value); return false">
- <input type="text" size="50" id="addressInput" name="address" value="Type your origin here" />
- <input type="submit" class="style4" value="Show Origin" />
- <div id="map" style="width: 300px; height: 200px"></div></td>
- </form>
- <form action="http://morar.geos.ed.ac.uk/~s0679212/cgi_bin/sql_test.pl" method="POST" onsubmit="return setVars();">
- <input type="hidden" id="orig" name="Origin">
- <input type="text" name="Time">
- </form>
Thanks in advance for your help