<SCRIPT LANGUAGE="JavaScript1.2">
function highlightie5(menuid) {  
   if (event.srcElement!=null) {  
      if (event.srcElement.className == "menuitems") {  
         var menu=document.all(menuid);alert(menu.name); 
      }  
   }  
}
</SCRIPT>
<div id="TreeMenu" onmouseover="highlightie5('TreeMenu')" name='tree1' class=menuitems>welcome</div>

解决方案 »

  1.   

    谢谢大哥,糊涂了,再请问一个,在style属性中定义css和通过class引入.css文件,两个做法有什么区别,我在.class文件中定义了div的bordercolor,结果通过mydiv.style.bordercolor访问不了,得到是空值..怎么回事呢
      

  2.   

    mydiv.style.borderColor
    记得c要大写哦
      

  3.   

    大哥们,不行啊,我的代码是:
    <html>
    <head>
    <style>
    .skin0 { 
    position:absolute; 
    text-align:left; 
    width:80px; 
    font-family:Verdana; 
    line-height:20px; 
    cursor:default; 
    visibility:hidden; 
    border-color : #307ce8;
    border-style : solid;
    border-top-width : 1px;
    border-left-width : 10px;
    border-right-width : 1px;
    border-bottom-width : 1px;
    BACKGROUND-COLOR: #ffffff;} 
    .menuitems {
    color:black;
    FONT-SIZE: 12px; 
    text-align:left;
    background:transparent;
    width:100%;
    border:0
    }
    </style>
    ....
    <SCRIPT LANGUAGE="JavaScript1.2">
    function highlightie5(menuid) {  
       if (event.srcElement!=null) {  
          if (event.srcElement.className == "menuitems") {  
             alert(alert(document.all(menuid).style.borderColor); 
          }  
       }  
    }
    </SCRIPT>
    ....<div id="TreeMenu" class="skin0" onMouseover="highlightie5('TreeMenu')">
    ....
    </div>
      

  4.   

    onMouseover事件更本就不能激发
      

  5.   

    不可能吧,alert函数被执行了。
      

  6.   

    在style标签中定义的border-color用js读不到值,在div中直接加border-color属性才可以读到
    <html>
    <head>
    <style>
    .skin0 { 
    position:absolute; 
    text-align:left; 
    width:80px; 
    font-family:Verdana; 
    line-height:20px; 
    cursor:default; 
    visibility:visible; 
    border-color : #307ce8;
    border-style : solid;
    border-top-width : 1px;
    border-left-width : 10px;
    border-right-width : 1px;
    border-bottom-width : 1px;
    BACKGROUND-COLOR: #ffffff;} 
    .menuitems {
    color:black;
    FONT-SIZE: 12px; 
    text-align:left;
    background:transparent;
    width:100%;
    border:0
    }
    </style>
    <SCRIPT LANGUAGE="JavaScript1.2">
    function highlightie5(menuid) {  
       if (event.srcElement!=null) {  
          if (event.srcElement.className == "skin0") {  
             alert(document.all(menuid).style.borderColor); 
          }  
       }  
    }
    </SCRIPT><div id="TreeMenu" class="skin0" onMouseover="highlightie5('TreeMenu')" style="border-color:#cccccc">
    hello everyone
    </div>
      

  7.   

    谢谢seabell(百合心) ,晕倒..