<div  id="productSwitcher" onclick="mm(this, event)">
<a id="list1"  class="ontime" href="#">首  页 </a>
<a id="list2"  href="#">采购管理</a>
<a id="list3"  href="#">销售管理</a>
<a id="list4"  href="#">库存管理</a>
<a id="list5"  href="#">财务管理</a>
<a id="list6"  href="#">系统管理</a>
<div style="clear:both;"></div>
</div>
<SCRIPT LANGUAGE="JavaScript">
<!--
function mm(div, e)
{
  e = window.event||e;
  e = e.srcElement || e.target;
  if(e.tagName=="A")
  {
    var a = div.childNodes;
    for(var i=0; i<a.length; i++)
    {
      if(a[i].nodeType==1) a[i].className="";
    }
    e.className="ontime"
  }
}
//-->
</SCRIPT>

解决方案 »

  1.   

    <style type="text/css">
     .myColor{color:yellow;}
    </style>
    <a id="list2"  href="#" onclick="this.className='myColor'">采购管理</a>
      

  2.   

    meizz(梅花雪) 
    试了一下,查看源文件的时候,没有看到有加进入class="ontime"
      

  3.   

    因为样式没有显示出来,查看源文件的时候也没找着有class="ontime"
      

  4.   

    在后面加上
    document.getElementByid('list2').class= 'ontime';其它依次类推!
      

  5.   

    不能直接看源文件要这样alert(document.body.innerHTML);
      

  6.   

    自己看有没有效果?<style type="text/css">
    .ontime{font-size: 14px; font-weight: bold}
    </style><div  id="productSwitcher" onclick="mm(this, event)">
    <a id="list1"  class="ontime" href="#">首  页 </a>
    <a id="list2"  href="#">采购管理</a>
    <a id="list3"  href="#">销售管理</a>
    <a id="list4"  href="#">库存管理</a>
    <a id="list5"  href="#">财务管理</a>
    <a id="list6"  href="#">系统管理</a>
    <div style="clear:both;"></div>
    </div>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function mm(div, e)
    {
      e = window.event||e;
      e = e.srcElement || e.target;
      if(e.tagName=="A")
      {
        var a = div.childNodes;
        for(var i=0; i<a.length; i++)
        {
          if(a[i].nodeType==1) a[i].className="";
        }
        e.className="ontime"
      }
    }
    //-->
    </SCRIPT>
      

  7.   

    JS 是对内存中 DOM 页面操作,不会修改源代码!