<html>
<head>
<script type="text/javascript" language="javascript">
function show()
{
var t = document.getElementById("t1");
var a = document.selection.createRange().parentElement();
alert(t.contains(a));
}
</script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="t1">
<tr>
<td align="center"><div><a href="/" class="bai"><font color="#FF0000" id="a1">首页</font></a></div></td>
</tr>
<tr>
<td height="10">rfhfd</td>
</tr>
</table>
<input type="button" οnclick="show()" value="easfs" />
</body>
</html>
转载于:https://www.cnblogs.com/pwqzc/archive/2005/12/03/289951.html