[原]选中行后高亮显示

<!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>
<script type="text/javascript">
function omm(oEle)
{
 if(oEle.selected!="true")
  {
    oEle.style.backgroundColor = "#f00";
  }
}

function omo(oEle)
{
 if(oEle.selected!="true")
  {
    oEle.style.backgroundColor = "#fff";
  }
}

function currentEle(oEle)
{
  var oUl = document.getElementById("ulMenu");
  for (var i=0; i<oUl.childNodes.length; i++)
  {
  oUl.childNodes[i].selected = "false";
  oUl.childNodes[i].style.backgroundColor = "#fff";
  oUl.childNodes[i].style.fontWeight = "normal";
  }
  oEle.parentElement.style.backgroundColor = "#f00"
  oEle.parentElement.style.fontWeight = "bold";     
  oEle.parentElement.selected = "true";
}   
</script>
</head>

 <body>
 <div id="" class="leftMenuWrapper">
  <ul id="ulMenu">
    <li onmousemove="omm(this)" onmouseout="omo(this)" selected="false"><a href="BJNewsCategory_List.aspx?tid=21&pid=3" target="mainFrame" onclick="currentEle(this)">新闻分类管理</a></li>
    <li onmousemove="omm(this)" onmouseout="omo(this)" selected="false"><a href="BJNews_List.aspx?tid=2&pid=2" target="mainFrame" onclick="currentEle(this)">新闻管理</a></li>
    <li onmousemove="omm(this)" onmouseout="omo(this)" selected="false"><a href="BJProductCategory_List.aspx?tid=22&pid=6" target="mainFrame" onclick="currentEle(this)">产品分类管理</a></li>
    <li onmousemove="omm(this)" onmouseout="omo(this)" selected="false"><a href="BJProduct_List.aspx?tid=8&pid=5" target="mainFrame" onclick="currentEle(this)">产品管理</a></li>
  </ul>
 </div>
 </body>
</html>

Keywords:选中高亮,选中行高亮,li高亮,取得父元素,取得父节点

原文地址:https://www.cnblogs.com/Kennytian/p/1088678.html