473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Javascript code working in IE and Mozilla but not in Mac

12
Hi guys

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
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2.     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
  6. <title>Welcome to the Lothian Buses Dynamic Route Selector</title>
  7.     <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA0j3m7rlEW8A2mxzuyAzXrRQ6jALPQpIWZWNXAFq4N3n_zdAATRSXIi4bVnf99msiXGgcZ9wmNmvEzA"
  8.       type="text/javascript"></script>
  9.  
  10.     <script type="text/javascript">
  11.     //<![CDATA[
  12.  
  13.     var map;
  14.     var geocoder = null;
  15.     var addressMarker;
  16.     var originpoint = null;
  17.     var destinationpoint = null;
  18.  
  19.  
  20.     function load() {
  21.       if (GBrowserIsCompatible()) {
  22.         map = new GMap2(document.getElementById("map"));
  23.         map.addControl(new GSmallMapControl());
  24.         map.addControl(new GMapTypeControl());
  25.         map.setCenter(new GLatLng(55.950254, -3.187606), 10);
  26.  
  27.         geocoder = new GClientGeocoder();
  28.       }
  29.     }
  30.  
  31.     function showAddress(address) {
  32.       if (geocoder) {
  33.         geocoder.getLatLng(address,
  34.           function(point1) {
  35.             if (!point1) {
  36.               alert(address + " not found");
  37.             } else {
  38.               if (addressMarker) {
  39.                 map.removeOverlay(addressMarker);
  40.               }
  41.               addressMarker = new GMarker(point1);
  42.               map.setCenter(point1, 15);
  43.               map.addOverlay(addressMarker);
  44.               originpoint = point1;
  45.             }
  46.           }
  47.         );
  48.       }
  49.     }
  50.  
  51.  
  52.       function setVars()
  53.       {
  54.           document.getElementById('orig').value = originpoint;
  55.           return true;
  56.       }
  57.  
..................... And here is the html form that passes the variables:

Expand|Select|Wrap|Line Numbers
  1. <form action="#" onsubmit="showAddress(this.address.value); return false">
  2. <input type="text" size="50" id="addressInput" name="address" value="Type your origin here" />
  3. <input type="submit" class="style4" value="Show Origin" />
  4. <div id="map" style="width: 300px; height: 200px"></div></td>
  5. </form>
  6.  
  7. <form action="http://morar.geos.ed.ac.uk/~s0679212/cgi_bin/sql_test.pl" method="POST" onsubmit="return setVars();">
  8. <input type="hidden" id="orig" name="Origin">
  9. <input type="text" name="Time">
  10. </form>
  11.  
Can anyone suggest something might might be wrong with this? Or something I can change for Mac users?

Thanks in advance for your help
Jul 27 '07 #1
1 1536
pbmods
5,821 Expert 4TB
Heya, Harch.

What is it doing wrong on a Mac? Is this strictly related to Safari, or does it fail in Firefox on a Mac as well?
Jul 28 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.