1、css样式
这是我的style代码:<style type="text/css"> 
.anylinkcss{ 
position:absolute; 
visibility: hidden; 
border:1px solid black; 
border-bottom-width: 1px; 
font:normal 12px Arial Narrow;
font-clocr:black; 
line-height: 18px; 
z-index: 100;  
width: 90px; 
} .anylinkcss a{ 
width: 100%; 
display: block; 
text-indent: 3px;
border-bottom: 0px solid black; 
padding: 1px 0;   
text-indent: 5px; 
font-clocr:black;
} .anylinkcss a:hover{ /*hover background color*/ 
background-color:Silver; 
color: red;
text-decoration: underline; 
} </style>
这是我的菜单,是用图片连接的,我把鼠标放在图片上,下面那个菜单就出来了,现在的问题是,我把鼠标放在图片上,还没放在菜单那些字上,那些字竟然是紫色的!我希望是黑色的呀~~~~
<asp:Image ID="Image1" runat="server"  ImageUrl="~/image/index.jpg" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, 'anylinkmenu1')" onmouseup="changepicture()"/><div id="anylinkmenu1" class="anylinkcss" style="width: 87px; background-color:White"> <a href="">图形图像</a> 
<a href="">鼠标事件</a> 
<a href="">时间日期</a> 
<a href="">导航菜单</a> 
<a href="">窗体变化</a> 
<a href="">表单按钮</a> 
<a href="">特殊脚本</a> 
<a href="">游戏娱乐</a> 
</div>
2、图片转换,也就是说我把鼠标放在图片上,图片换成另外一张图片了,上面有我那个图片的连接。
我在onmouseover触发的dropdownmenu这个function里写了这么一句话:document.all.Image1.src="~/image/indexlink.jpg"
在onmouseup触发的changepicture这个function里写了这么一句话:
document.all.Image1.src= "~/image/index.jpg"
可是为什么这个效果不能实现呢?!请高手们帮帮我吧...我做毕设做的好痛苦....

解决方案 »

  1.   

    样式问题可以发到HTML(css)版块去,那里这方面的人很多
      

  2.   

    font-clocr:black;  这个无效 应该是 color:black最好先学css再学javascript。一开始不要急着搞弹出菜单之类的东西。
    javascript不支持~,应该用../表示上一级目录
      

  3.   

    谢谢楼上,我按照你的改成color:black也还是没变化,然后目录的那个改成../仍然没有变化...
      

  4.   

    .anylinkcss a这里改了?把代码贴全,我下载看一下
      

  5.   

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="daohang.aspx.cs" Inherits="daohang" %><!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 runat="server">
        <title>无标题页</title>
    <style type="text/css"> 
    .anylinkcss{ 
    position:absolute; 
    visibility: hidden; 
    border:1px solid black; 
    border-bottom-width: 1px; 
    font-size:12px;
    font-family: Arial Narrow;
    clocr:black; 
    line-height: 18px; 
    z-index: 100;  
    width: 90px;
    } .anylinkcss a{ 
    width: 100%; 
    display: block; 
    text-indent: 3px;
    padding: 1px 0;   
    text-indent: 5px; 
    clocr:black;
    } .anylinkcss a:hover{ /*hover background color*/ 
    background-color:Silver; 
    color: red;
    text-decoration: underline; 
    }
    </style> 
    <script language="javascript"> 
    var disappeardelay=250 
    var enableanchorlink=0 
    var hidemenu_onclick=1 var ie5=document.all 
    var ns6=document.getElementById&&!document.all function getposOffset(what, offsettype){ 
    var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop; 
    var parentEl=what.offsetParent; 
    while (parentEl!=null){ 
    totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop; 
    parentEl=parentEl.offsetParent; 

    return totaloffset; 
    } function showhide(obj, e, visible, hidden){ 
    if (ie5||ns6) 
    dropmenuobj.style.left=dropmenuobj.style.top=-500 
    if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover") 
    obj.visibility=visible 
    else if (e.type=="click") 
    obj.visibility=hidden 
    } function iecompattest(){ 
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body 
    } function clearbrowseredge(obj, whichedge){ 
    var edgeoffset=0 
    if (whichedge=="rightedge"){ 
    var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15 
    dropmenuobj.contentmeasure=dropmenuobj.offsetWidth 
    if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure) 
    edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth 

    else{ 
    var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18 
    dropmenuobj.contentmeasure=dropmenuobj.offsetHeight 
    if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure) 
    edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight 

    return edgeoffset 
    } function dropdownmenu(obj, e, dropmenuID){ 
    if (window.event) event.cancelBubble=true 
    else if (e.stopPropagation) e.stopPropagation() 
    if (typeof dropmenuobj!="undefined") 
    dropmenuobj.style.visibility="hidden" 
    clearhidemenu() 
    if (ie5||ns6){ 
    obj.onmouseout=delayhidemenu 
    dropmenuobj=document.getElementById(dropmenuID) 
    if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'} 
    dropmenuobj.onmouseover=clearhidemenu 
    dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)} 
    showhide(dropmenuobj.style, e, "visible", "hidden") 
    dropmenuobj.x=getposOffset(obj, "left") 
    dropmenuobj.y=getposOffset(obj, "top") 
    dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px" 
    dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px" 

    return clickreturnvalue()
    } function clickreturnvalue(){ 
    if ((ie5||ns6) && !enableanchorlink) return false 
    else return true 
    } function contains_ns6(a, b) { 
    while (b.parentNode) 
    if ((b = b.parentNode) == a) 
    return true; 
    return false; 
    } function dynamichide(e){ 
    if (ie5&&!dropmenuobj.contains(e.toElement)) 
    delayhidemenu() 
    else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget)) 
    delayhidemenu() 
    } function delayhidemenu(){ 
    delayhide=setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay) 
    } function clearhidemenu(){ 
    if (typeof delayhide!="undefined") 
    clearTimeout(delayhide)
    }
    </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
    <a href="" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, 'anylinkmenu2')">网络学院</a> <div id="anylinkmenu2" class="anylinkcss" style="width: 150px; background-color:white"> <a href="">网页制作</a> 
    <a href="">网络编程</a> 
    <a href="">图形图像</a> 
    <a href="">多媒体制作</a> 
    <a href="">网站建设</a> 
    <a href="">操作系统</a> 
    </div>
            </div>
        </form>
    </body>
    </html>
      

  6.   

    第二个这样写试试看,有时候不同浏览器支持不一样。
    document.getElementById("Image1").src="~/image/index.jpg";