当前位置:编程学习 > C#/ASP.NET >>

网页中,把鼠标放在一条新闻上如何显示提取的字段,如图



谢谢大虾们指点! 提取 鼠标 --------------------编程问答-------------------- like this?


http://www.cnblogs.com/insus/archive/2011/09/07/2169844.html --------------------编程问答-------------------- <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication5.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="jquery-1.7.1.min.js"></script>
    <style>
        .news
        {
            width: 150px;
            height: 300px;
            border: 1px solid red;
            overflow: hidden;
        }

        ul
        {
            margin: 0;
            padding: 0;
            height:250px;
        }

        li
        {
            margin: 0;
            padding: 0;
            list-style-type: none;
            height: 40px;
        }
        .newstip
        {
            display:none;
            position:absolute;
            /*margin-top:100px;
            margin-left:100px;*/
        }
    </style>
    <script type="text/javascript">
        $(function () {

            $("li").mouseover(function () {
                var t = $(this).html();
                $("#newstip").html(t);
                $("#newstip").css("display", "block");
               
                var x = event.clientX+30;
                var y = event.clientY+30;

                $("#newstip").css("margin-left", x+"px");
                $("#newstip").css("margin-top", y+"px");
            });
            $("li").mouseout(function () {
                $("#newstip").html("");
                $("#newstip").css("display", "none");
            });

        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
          <div id="newstip" class="newstip">

           </div>
        <div class="news">
            <ul>
                <li><a href="#">1111111111111111ffffffffffffff</a></li>
                <li><a href="#">1111111111111111</a></li>
                <li><a href="#">1111111111111111</a></li>
                <li><a href="#">1111111111111111</a></li>
                <li><a href="#">1111111111111111</a></li>
                <li><a href="#">1111111111111111</a></li>
            </ul>
          
        </div>
    </form>
</body>
</html>

        
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,