Prova cosi

codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title>a</title>
		<meta name="vs_defaultClientScript" content="JavaScript">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
		<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
		<meta name="ProgId" content="VisualStudio.HTML">
		<meta name="Originator" content="Microsoft Visual Studio .NET 7.1">
<script language="javascript">
<!--
function controllo(v)
{
	//alert(v.parentNode.parentNode.parentNode.parentNode.tagName);
	var x = prova(v);
	alert(x.tagName);
	
}

function prova(v)
{
	
	if(v.parentNode.tagName == "TR")
		return v.parentNode;
	else
		return prova(v.parentNode);
}

//-->
</script>

	</head>
	<body MS_POSITIONING="FlowLayout">
		<table>
			<tr>
				<td>
					<div>
						<span><img onclick="controllo(this);"></span>
					</div>
				</td>
			</tr>
		</table>
	</body>
</html>