你这样还不如做成table,然后每个tr有个id
在函数里面动态改tr内容就是了

解决方案 »

  1.   

    我想根据点击超连接的不同,显示出一个不同的菜单,并且只使用一个menu1变量!楼上的兄弟情指点!谢了!!!
    <html><head>
    <style>
    .iewrap1
    {
    position:relative;
    height:30px;
    ; font-family: "宋体"; font-size: 9pt
    }
    .iewrap2
    {
    position:absolute;
    ; font-family: "宋体"; font-size: 9pt
    }
    #dropmenu0, #dropmenu1
    {
    visibility:hide;
    z-index:100;
    }
    #dropmenu0 { font-family: "宋体" ; font-size: 9pt}
    #dropmenu1 { font-family: "宋体" ; font-size: 9pt}
    </style>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>天蓝网</title>
    </head><body >
    <script language="JavaScript">
    var menu1=new Array()var zindex=100
    function dropit2(whichone)
    {
    if (window.themenu&&themenu.id!=whichone.id)
    themenu.style.visibility="hidden"
    themenu=whichone
    if (document.all)
    {
    themenu.style.left=document.body.scrollLeft+event.clientX-event.offsetX
    themenu.style.top=document.body.scrollTop+event.clientY-event.offsetY+18
    if (themenu.style.visibility=="hidden")
    {
    themenu.style.visibility="visible"
    themenu.style.zIndex=zindex++
    }
    else
    {
    hidemenu()
    }
    }
    }
    function dropit(e,whichone)
    {
    if (window.themenu&&themenu.id!=eval(whichone).id)
    themenu.visibility="hide"
    themenu=eval(whichone)
    if (themenu.visibility=="hide")
    themenu.visibility="show"
    else
    themenu.visibility="hide"
    themenu.zIndex++
    themenu.left=e.pageX-e.layerX
    themenu.top=e.pageY-e.layerY+19
    return false
    }function dropit3(e,whichone,id)
    {menu1[0]='<a href="http://163.com?name="+id target="_blank"><font color="#ffcc00" face="Arial">FRONTPAGE</font></a><br>'
    menu1[1]='<a href="http://21cn.com?name="+id target="_blank"><font color="#ffcc00" face="Arial">PHOTOSHOP</font></a><br>'
    menu1[2]='<a href="http://www.xinhuanet.com?name="+id target="_blank"><font color="#ffcc00" face="Arial">HTML</font></a><br>'
    if (window.themenu&&themenu.id!=eval(whichone).id)
    themenu.visibility="hide"
    themenu=eval(whichone)
    if (themenu.visibility=="hide")
    themenu.visibility="show"
    else
    themenu.visibility="hide"
    themenu.zIndex++
    themenu.left=e.pageX-e.layerX
    themenu.top=e.pageY-e.layerY+19
    return false
    }
    function hidemenu(whichone)
    {
    if (window.themenu)
    themenu.style.visibility="hidden"
    }function hidemenu2()
    {
    themenu.visibility="hide"
    }if (document.all)
    document.onclick=hidemenu

    </script>
    <ilayer height=35px>
    <layer visibility=show>
    <span class=iewrap1>
    <span class=iewrap2 onClick="dropit2(dropmenu0);event.cancelBubble=true;return false">
    <font face=宋体>
    <a href="#" onClick="if(document.layers) return dropit3(event, 'document.dropmenu0','a')">天蓝网1</a><br><br><br><br>
    </font>
    </span>
    </span>
    </layer>
    </ilayer><br><ilayer height=35px>
    <layer visibility=show>
    <span class=iewrap1>
    <span class=iewrap2 onClick="dropit2(dropmenu0);event.cancelBubble=true;return false">
    <font face=宋体>
    <a href="#" onClick="if(document.layers) return dropit3(event, 'document.dropmenu0','b')">天蓝网2</a><br><br><br><br>
    </font>
    </span>
    </span>
    </layer>
    </ilayer><br><div id=dropmenu0 style="position:absolute;left:0;top:0;layer-background-color:#408080;background-color:#408080;visibility:hidden;border:1px solid black;padding:0px">
    <script language="JavaScript">menu1[0]='<a href="http://163.com" target="_blank"><font color="#ffcc00" face="Arial">FRONTPAGE</font></a><br>'
    menu1[1]='<a href="http://21cn.com" target="_blank"><font color="#ffcc00" face="Arial">PHOTOSHOP</font></a><br>'
    menu1[2]='<a href="http://www.xinhuanet.com" target="_blank"><font color="#ffcc00" face="Arial">HTML</font></a><br>'
    if (document.all)
    dropmenu0.style.padding="4px"
    for (i=0;i<menu1.length;i++)
    document.write(menu1[i])</script>
    </div>
    </body></html>