try it:tv 为treeview的id<script language="javascript">
<!--
function tv.onclick()
{
   if (document.all.tv.clickedNodeIndex!=null)
{
        document.all.nd.value=document.all.tv.clickedNodeIndex;
var node=document.all.tv.getTreeNode(document.all.tv.clickedNodeIndex);
alter(node.getAttribute("id"));
           }
}
-->
</script>