Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 361
  • Last Modified:

Google Javascript issues in Explorer 8 and Firefox

The code below no longer works in Explorer 8 or Firefox. When I set compatibility mode it works.

Trying to add a point to a Google map and change the cursor to a "crosshair" to do so.

function Add_Point_Enable()
 {	
	//Allows user to add a new point to the map by clicking on the map
	alert('Move the cursor to the desired location');
	document.getElementById("datatable").style.display = "";
	document.getElementById("Cancel").disabled=false;
	map.getDragObject().setDraggableCursor("crosshair");
	GEvent.addListener(map, "click", function(marker, point) 
		{  
		 document.getElementById('currentid').value = "";
		 ChangeButtons();
			if (marker) 
			{    
				
			} 
			else 
			{    
				var confirmpoint = confirm("Do you want to add a signal to this location?");
				
				if (confirmpoint)
				{
					map.clearOverlays();
					GetData();
					map.addOverlay(new GMarker(point));
					ClearData();
					document.mapform.newlat.value = point.y;
					document.mapform.newlon.value = point.x;
					document.getElementById("Save").disabled=false;
					document.getElementById("Add").disabled=true;
					//document.getElementById("storydisplay").style.display = "none"; 
				} 
			}
		} // close of function(marker,point)
	); //close of listener
}

Open in new window

0
Alemus
Asked:
Alemus
  • 7
  • 6
1 Solution
 
Kim WalkerWeb Programmer/TechnicianCommented:
Please elaborate on "no longer works." Are you getting an error? Are you getting unexpected results?

Can you post a link to a page where this code is being used?
0
 
AlemusAuthor Commented:
The code is on a password protected page. This code is supposed to trigger a change in the cursor from the hand to a crosshair and allow the adding of points to a Google map.

when I say "no longer works", when i click the button that is supposed to trigger this even, nothing happens.

Right now I can post a link because the code is on a protected web site.
0
 
Kim WalkerWeb Programmer/TechnicianCommented:
Are you certain that no error is being generated? In IE, you would see a message in the status bar at the bottom if you have the status bar turned on. In Firefox you can view the error console under the Tools menu.

Are you getting the alert to move the cursor to the desired location?
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
AlemusAuthor Commented:
Yes the alert asking me to move the cursor i sappearing (line 4)

It looks like I actually am getting an error
Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2; MS-RTC LM 8; .NET4.0C; .NET4.0E)
Timestamp: Mon, 12 Sep 2011 14:24:22 UTC


Message: 'document.getElementById(...)' is null or not an object
Line: 254
Char: 2
Code: 0
URI: http://www.nctcog.org/trans/data/tcins/trafficsignals/admintrafficsignals.asp


However, this error is occuring outside of the current function
0
 
Kim WalkerWeb Programmer/TechnicianCommented:
Is line 254 one of the line is the above code? Check your spelling in the the getElementById arguments. IDs are case-sensitive.
0
 
AlemusAuthor Commented:
The spelling is correct but it points to an element ID assigned to a <TD>  I tried moving the ID to a <div> and that didn't seem to solve the problem.
0
 
Kim WalkerWeb Programmer/TechnicianCommented:
Do you have two elements with the same ID?
0
 
Kim WalkerWeb Programmer/TechnicianCommented:
No. That can't be it; you wouldn't get the error "is null or not an object" if that was the case. Have you used a reserved word as an ID? What is the ID of the element line 254 is trying to get?
0
 
AlemusAuthor Commented:
The ID is "AddButtons".
0
 
Kim WalkerWeb Programmer/TechnicianCommented:
This is perplexing. It would be easier if I could see the page. I'm sure you've checked your HTML and confirmed there is an element with the exact ID "AddButtons." Is it possible that element is inside the div that is consumed by the google map?
0
 
AlemusAuthor Commented:
I actually just found the problem and you set me on the right path by having me double check my element IDs.
It turns out I didn't have one mispelled, but I did have one that wasn't declared.  It was an input type that had its name set but not the ID
0
 
AlemusAuthor Commented:
As I mentioned in my last comment, this wan't the actual solution, but it made me re-examine my form elements and find the one with the name declared but not the id.
0
 
Kim WalkerWeb Programmer/TechnicianCommented:
Aa Hah! The old name/id switcheroo! I've done the same. Glad I could steer you in the right direction.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now