87,915
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<script type="text/javascript">
<!--
function ShowDirection() {
var tbl = [];
var direct = (document.selection && document.selection.createRange)
? document.selection.createRange().parentElement() // IE
: window.getSelection().focusNode.parentNode; // FF
alert(direct.tagName + ': ' + direct.innerHTML);
}
//-->
</script>
</head>
<body>
<div>12345677aaaaa888888 </div>
<input type="button" value="ShowDirection" onclick="ShowDirection()" />
</body>
</html>