你那个好像有规律,那直接用for去根据规律改就行了。
for(var i=1; i<=8; i++){
$("M"+i).over="../Images/Cn/Menu2_" + parseInt((2*i)-1) + ".gif"
$("M"+i).out="../Images/Cn/Menu_" + parseInt((2*i)-1) + ".gif"
$("M"+i).onmouseover=function(){this.src=this.getAttribute("over") } 
$("M"+i).onmouseout=function(){this.src=this.getAttribute("out") }

解决方案 »

  1.   

    有时该省的就省 没事别偷懒 
    <script type="text/javascript">
    function $(Obj){
    return document.getElementById(Obj);
    }
    var Serkey = $("Serkey");
    Serkey.onfocus=function(){this.value="";}
    Serkey.onblur=function(){
    if(this.value==""){
    this.value="资料搜索";
    }
    }
    var Sub = $("Sub");
    Sub.onclick=function(){
    if(Serkey.value==""||Serkey.value=="资料搜索"){
    Serkey.value="";
    alert("搜索关健字不能为空");
    return false;
    }else{
    return true;
    }
    }
    with($("M1"))
    {
    onmouseover=function(){this.src="../Images/Cn/Menu2_1.gif";}
    onmouseout=function(){this.src="../Images/Cn/Menu_1.gif";}
    }
    with($("M2"))
    {
    onmouseover=function(){this.src="../Images/Cn/Menu2_3.gif";}
    onmouseout=function(){this.src="../Images/Cn/Menu_3.gif";}
    }
    //....下略
    </script>