我想问题可能出现在这句obj.filters.alpha.opacity

解决方案 »

  1.   

    改完,代码如下:
    <html> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
    <title> 淡入淡出菜单演示 </title> 
    <style> 
    .sml_menu {font-size: 9pt; color: white; cursor: hand; font-family: Tahoma;} 
    .font3 {font-size: 10.5pt; color: 147e19; font-family: Courier New;} 
    .menuitem {font-size: 10.5pt; color: white; cursor: default; font-family: Courier New;} 
    </style> 
    <script language="javascript"> 
    var intDelay=30; //设置菜单显示速度,越大越慢,不超过100为好 
    var intInterval=5; //每次更改的透明度,最好小于10 
    //以下代码需要改的地方可以更改 
    function MenuClick() 

    if (one.style.display=="") 

     one.style.display="none"; //当菜单显示的时候单击就关闭菜单 

    else{ 
     one.filters.Alpha.Opacity=0; 
     one.style.display=""; 
     GradientShow(one); //淡入 
      } 

    //Opacity
    function GradientShow() //实现淡入的函数 

    one.filters.Alpha.Opacity+=intInterval; 
    if (one.filters.Alpha.Opacity<100)
    setTimeout("GradientShow()",intDelay); 
    } function GradientClose() //实现淡出的函数 

    one.filters.Alpha.Opacity-=intInterval; 
    if (one.filters.Alpha.Opacity>0) { 
      setTimeout("GradientClose()",intDelay); 
      } 
     else { 
      one.style.display="none"; //当看不到菜单层后还需要把这个层隐藏起来 
      } 
    } function ChangeBG() //改变菜单项的背景颜色,这里的两种颜色值可以改为你需要的 

     oEl=event.srcElement; 
     if (oEl.style.background!="navy") { 
      oEl.style.background="navy"; 
      } 
      else { 
      oEl.style.background="#147e19"; 
      } 
    } function ItemClick() //在菜单项上单击后打开相应链接 

    oEl=event.srcElement; 
    oLink=oEl.all.tags( "A" ); 
    if( oLink.length ) 

    oLink[0].click(); 
    GradientClose(obj); 


    </script> 
    </head> 
    <body onMouseover="GradientClose(one);"> 
    <br> 
    <p align=center class=font3>LiveMenu V1.0 by [email protected]<br>请查看源代码<br> 
    请手动设置菜单层或菜单提示层的具体位置<br> 
    在: style="Position:Absolute;Left:???px;Top:???px;" 处设置</p> 
    <!--菜单提示层开始--> 
    <div style="Position:Absolute;Left:150px;Top:120px;" onClick="MenuClick(one)"> 
    <table border=0 cellpadding=0 cellspacing=0 width=50><tr><td bgcolor=#147e19 class=sml_menu height=15 onselectstart="return false;" align=center valign=top>&nbsp;one</td></tr></table> 
    </div> 
    <!--菜单提示层结束--> 
    </body> 
    <!--菜单层开始--> 
    <div id=one style="Position:Absolute;Left:200px;Top:120px;Display:none;filter:alpha(opacity=0);" oncontextmenu="return false" onMouseover="window.event.cancelBubble = true;"> 
    <!--上面一行的onMouseover事件是很关键的--> 
    <table border=0 cellpadding=0 cellspacing=0 bgcolor=147e19> 
    <tr><td height=1 bgcolor=#f0f0f0 colspan=2></td></tr> 
    <tr><td width=20 valign=bottom bgcolor=navy></td> 
    <td> 
     <table border=0 width=200 cellpadding=0 cellspacing=0 onselectstart="return false;" onclick="ItemClick();" onMouseover="ChangeBG();" onMouseout="ChangeBG();"> 
      <tr><td class=menuitem height=20 style="background: 147e19;"><a href=/First></a>1.The First Menu Item</td></tr> 
      <tr><td class=menuitem height=20 style="background: 147e19;"><a href=/Second></a>2.The Second Menu Item</td></tr> 
      <tr><td class=menuitem height=20 style="background: 147e19;">3.The Third Menu Item</td></tr> 
      <tr><td class=menuitem height=20 style="background: 147e19;">4.The Fourth Menu Item</td></tr> 
     </table> 
    </td></tr> 
    </table> 
    </div> 
    <!--菜单层结束-->  
    </html>
      

  2.   

    刚才那个还有一点小错,现在这个正确的:
    <html> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
    <title> 淡入淡出菜单演示 </title> 
    <style> 
    .sml_menu {font-size: 9pt; color: white; cursor: hand; font-family: Tahoma;} 
    .font3 {font-size: 10.5pt; color: 147e19; font-family: Courier New;} 
    .menuitem {font-size: 10.5pt; color: white; cursor: default; font-family: Courier New;} 
    </style> 
    <script language="javascript"> 
    var intDelay=30; //设置菜单显示速度,越大越慢,不超过100为好 
    var intInterval=5; //每次更改的透明度,最好小于10 
    //以下代码需要改的地方可以更改 
    function MenuClick() 

    if (one.style.display=="") 

     one.style.display="none"; //当菜单显示的时候单击就关闭菜单 

    else{ 
     one.filters.Alpha.Opacity=0; 
     one.style.display=""; 
     GradientShow(one); //淡入 
      } 

    //Opacity
    function GradientShow() //实现淡入的函数 

    one.filters.Alpha.Opacity+=intInterval; 
    if (one.filters.Alpha.Opacity<100)
    setTimeout("GradientShow()",intDelay); 
    } function GradientClose() //实现淡出的函数 

    one.filters.Alpha.Opacity-=intInterval; 
    if (one.filters.Alpha.Opacity>0) { 
      setTimeout("GradientClose()",intDelay); 
      } 
     else { 
      one.style.display="none"; //当看不到菜单层后还需要把这个层隐藏起来 
      } 
    } function ChangeBG() //改变菜单项的背景颜色,这里的两种颜色值可以改为你需要的 

     oEl=event.srcElement; 
     if (oEl.style.background!="navy") { 
      oEl.style.background="navy"; 
      } 
      else { 
      oEl.style.background="#147e19"; 
      } 
    } function ItemClick() //在菜单项上单击后打开相应链接 

    oEl=event.srcElement; 
    oLink=oEl.all.tags( "A" ); 
    if( oLink.length ) 

    oLink[0].click(); 
    GradientClose(); 


    </script> 
    </head> 
    <body onMouseover="GradientClose();"> 
    <br> 
    <p align=center class=font3>LiveMenu V1.0 by [email protected]<br>请查看源代码<br> 
    请手动设置菜单层或菜单提示层的具体位置<br> 
    在: style="Position:Absolute;Left:???px;Top:???px;" 处设置</p> 
    <!--菜单提示层开始--> 
    <div style="Position:Absolute;Left:150px;Top:120px;" onClick="MenuClick(one)"> 
    <table border=0 cellpadding=0 cellspacing=0 width=50><tr><td bgcolor=#147e19 class=sml_menu height=15 onselectstart="return false;" align=center valign=top>&nbsp;one</td></tr></table> 
    </div> 
    <!--菜单提示层结束--> 
    </body> 
    <!--菜单层开始--> 
    <div id=one style="Position:Absolute;Left:200px;Top:120px;Display:none;filter:alpha(opacity=0);" oncontextmenu="return false" onMouseover="window.event.cancelBubble = true;"> 
    <!--上面一行的onMouseover事件是很关键的--> 
    <table border=0 cellpadding=0 cellspacing=0 bgcolor=147e19> 
    <tr><td height=1 bgcolor=#f0f0f0 colspan=2></td></tr> 
    <tr><td width=20 valign=bottom bgcolor=navy></td> 
    <td> 
     <table border=0 width=200 cellpadding=0 cellspacing=0 onselectstart="return false;" onclick="ItemClick();" onMouseover="ChangeBG();" onMouseout="ChangeBG();"> 
      <tr><td class=menuitem height=20 style="background: 147e19;"><a href=/First></a>1.The First Menu Item</td></tr> 
      <tr><td class=menuitem height=20 style="background: 147e19;"><a href=/Second></a>2.The Second Menu Item</td></tr> 
      <tr><td class=menuitem height=20 style="background: 147e19;">3.The Third Menu Item</td></tr> 
      <tr><td class=menuitem height=20 style="background: 147e19;">4.The Fourth Menu Item</td></tr> 
     </table> 
    </td></tr> 
    </table> 
    </div> 
    <!--菜单层结束-->  
    </html>