954,566 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

javacsript "onClick" issue! HELP

Hello!
I have a table with cells, and each cell contains the following code:

<td align='center' bgcolor='#C45651' width='80' height='60' nowrap='yes' id='$' onClick='callPicture(this);'><p dir='ltr'><img border='0' src='X.jpg' width='80' height='60'></td>


The javascript function

function callPicture(ID){


gets the cell's ID and uses it.
(This table is being written cell be cell dynamically via ASP, and each cell gets a number as an ID instead of the '$'.)

This code works great in Internet Explorer (I'm using 8), but in firefox it simply won't work. and it doesn't say JavaScript error, it just does nothing.

Can someone help me with this onclick thing? :icon_question:
Or maybe an alternative that can still pass the cell's ID to the function?

THANKS

Gunto
Newbie Poster
1 post since Dec 2010
Reputation Points: 10
Solved Threads: 0
 

The code seems to be getting the id of the object in both firefox and IE.Try alerting it.Check what you are getting.

<script>
	function callPicture(ID)
	{
		alert(ID.id);
	}
</script>
@developer
Junior Poster in Training
70 posts since Nov 2010
Reputation Points: 13
Solved Threads: 10
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: