请问什么地方有js实现下拉菜单的效果列子, 就好像word的调色板按扭那样的效果。

解决方案 »

  1.   

    GOOGLE一下到处都是啊http://www.google.cn/search?hl=zh-CN&q=JS+%E4%B8%8B%E6%8B%89+%E8%8F%9C%E5%8D%95&meta=&aq=f&oq=
      

  2.   

    http://hi.baidu.com/chinaphper/blog/item/b77b9151dff64f1b377abe37.html
      

  3.   

    我想可能我说的不清晰, 我要的不是下拉菜单的效果, 是一个按扭, dropdownlist的按扭, 就好像是word的颜色选择器那样的效果。
      

  4.   

    差不多这样的?<!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>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head>
    <style type="text/css">
    .color{border:solid 1px #000000;width:140px;position:absolute;display:none;}
    .color div{overflow:hidden;width:10px;height:10px;margin:2px;float:left;}
    </style>
    <body>
    <button onclick="show()" id="picker">show</button>
    <script type="text/javascript">
    var div = document.createElement("div");
    div.className = "color";
    var color = ["00","33","66","99","cc","ff"];
    for(var i=0;i<10;i++)
    {
    for(var j=0;j<10;j++)
    {
    var index = getIndex();
    var d = document.createElement("div");
    d.style.backgroundColor = "#"+color[index[0]]+color[index[1]]+color[index[2]];
    div.appendChild(d);
    }
    var br = document.createElement("br");
    div.appendChild(br);
    }
    document.body.appendChild(div);function getIndex()
    {
    var index = new Array();
    index.push( parseInt(Math.random()*100,10) %6 );
    index.push( parseInt(Math.random()*100,10) %6 );
    index.push( parseInt(Math.random()*100,10) %6 );
    return index;
    }function getDomOffset(id)
    {   
    var el = document.getElementById(id);
    for(var lx=0,ly=0;el!=null; el=el.offsetParent)
    {
    lx+=el.offsetLeft;
    ly+=el.offsetTop;
    }   
    return   {x:lx,y:ly}   
    } function show()
    {
    var btn = document.getElementById("picker");
    if(div.style.display=="block")
    {
    btn.innerHTML = "隐藏";
    div.style.display="none";
    return;
    }
    else
    {
    btn.innerHTML = "显示";
    div.style.display="block";
    }
    var pos = getDomOffset("picker");
    var left = pos.x + 5;
    var top  = pos.y + btn.clientHeight + 5; 
    div.style.left = left+"px";
    div.style.top = top+"px";
    }
    </script>
    </body>
    </html>
      

  5.   

    是这样的, 如果我想下拉如此的菜单呢, 电击button, 下拉出这样的菜单, 该如何实现?
      

  6.   

    7楼不是已经有了,你就把button替换为图片按钮就好了
      

  7.   

    把button的换成img就好了啊
    <button onclick="show()" id="picker">show</button><img src="你图片地址" onclick="show()" id="picker" />