现有一个ul元素:<ul class='overdiv' onclick='' onmouseover=''>
    <li class="showImg"><input type="checkbox" name="chk0" class="chk" /><img id="ul0" src="images/net.png"/></li>
    <li><b>责任人:</b> ww </li>
</ul>
<div>
   这是单击击事件弹出的div
</div>如何给其添加单击和悬浮事件,显示div中的内容?
最好用jQuery

解决方案 »

  1.   

    楼主 这些都最基本的,建议看下jquery的api<!DOCTYPE HTML>
    <html>
        <head>
            <meta charset="gb2312" />
            <title></title>
            <style>
            </style>        
        </head>
        <body>
    <ul class='overdiv'>
        <li class="showImg"><input type="checkbox" name="chk0" class="chk" /><img id="ul0" src="images/net.png"/></li>
        <li><b>责任人:</b> ww </li>
    </ul>
    <div>
       这是单击击事件弹出的div
    </div>
     
    <script src="http://code.jquery.com/jquery-latest.js"></script>
            <script>
                $('.overdiv').mouseover(function(){
    alert( $('div').html() )
    })
            </script>
        </body>
    </html>
      

  2.   

    右键菜单?楼主可以参考下<!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=gbk" />
    <title>自定义右键菜单</title>
    <style type="text/css">
    body,ul,li{margin:0;padding:0;}
    body{font:12px/24px arial;}
    #menu{position:absolute;top:-9999px;left:-9999px;width:100px;border-radius:3px;list-style-type:none;border:1px solid #8f8f8f;padding:2px;background:#fff;}
    #menu li{position:relative;height:24px;padding-left:24px;background:#eaead7;vertical-align:top;}
    #menu li a{display:block;color:#333;background:#fff;padding-left:5px;text-decoration:none;}
    #menu li.active{background:#999;}
    #menu li.active a{color:#fff;background:#8f8f8f;}
    #menu li em{position:absolute;top:0;left:0;width:24px;height:24px;background:url(ico.png) no-repeat;}
    #menu li em.cur{background-position:0 0;}
    #menu li em.copy{background-position:0 -24px;}
    #menu li em.paste{background-position:0 -48px;}
    </style>
    <script type="text/javascript">
    window.onload = function ()
    {
    var oMenu = document.getElementById("menu");
    var aLi = oMenu.getElementsByTagName("li");
    //加载后隐藏自定义右键菜单
    oMenu.style.display = "none";
    //菜单鼠标移入/移出样式
    for (i = 0; i < aLi.length; i++)
    {
    //鼠标移入样式
    aLi[i].onmouseover = function ()
    {
    this.className = "active"
    };
    //鼠标移出样式
    aLi[i].onmouseout = function ()
    {
    this.className = ""
    }
    }
    //自定义菜单
    document.oncontextmenu = function (event)
    {
    var event = event || window.event;
    var style = oMenu.style;
    style.display = "block";
    style.top = event.clientY + "px";
    style.left = event.clientX + "px";
    return false;
    };
    //页面点击后自定义菜单消失
    document.onclick = function ()
    {
    oMenu.style.display = "none"
    }
    };
    </script>
    </head>
    <body>
    <center>自定义右键菜单,请在页面点击右键查看效果。</center>
    <ul id="menu">
        <li><em class="cut"></em><a href="javascript:;">剪切</a></li>
        <li><em class="copy"></em><a href="javascript:;">复制</a></li>
        <li><em class="paste"></em><a href="javascript:;">粘贴</a></li>
    </ul>
    </body>
    </html>
      

  3.   

    咕~~(╯﹏╰)b,这个,不好意思啊,我要的就是这个效果:但有没有jQuery代码?
      

  4.   

    楼主 这个插件很不错
    http://www.planeart.cn/demo/artDialog/_doc/new.html
      

  5.   

    差不多解决了,加了:$("li").live("click",function(e){
    if(!control) return;
      var e = e || window.e;
    top = e.clientY + "px";
             left = e.clientX + "px";
    });