异想天开的想法,大家进来看看能实现吗?

OnlyVB 2011-08-30 09:26:29
鼠标放在背景图片上,改变鼠标形状,咋实现?
<div style="font-size:xx-large;width:100%;text-align:center;padding-right:50px;background:url('http://www.baidu.com/img/baidu_sylogo1.gif') no-repeat right center;">测试</div>

目前实现的方法是用两个div,今天突然心血来潮,用一个div能实现吗?
...全文
206 23 打赏 收藏 转发到动态 举报
写回复
用AI写文章
23 条回复
切换为时间正序
请发表友善的回复…
发表回复
OnlyVB 2011-08-31
  • 打赏
  • 举报
回复
[Quote=引用 22 楼 sp1234 的回复:]
在鼠标点击图片时 --> 在鼠标在图片上移动时
[/Quote]
复杂了,看来还是用两个div比较方便
tengmingttmm 2011-08-30
  • 打赏
  • 举报
回复
希望能帮到楼主
tengmingttmm 2011-08-30
  • 打赏
  • 举报
回复



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

<!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 runat="server">
<title></title>
<style type="text/css">
#li1
{
cursor:help;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div style=" font-size:xx-large;width:400px; height:400px; background-color:Yellow;text-align:center;
padding-right:50px;">
<ul>
<li id="li1"
style=" width:276px; height:100px; list-style:none;background:url('http://www.baidu.com/img/baidu_sylogo1.gif')"></li>
</ul>
</div>
</form>
</body>
</html>


tengmingttmm 2011-08-30
  • 打赏
  • 举报
回复
可以楼主看我的不知道是否对你满意:


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!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 runat="server">
<title></title>
<style type="text/css">
#li1
{
cursor:help;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<div style=" font-size:xx-large;width:400px; height:400px; background-color:Yellow;text-align:center;
padding-right:50px;">
<ul>
<li id="li1"
style=" width:276px; height:100px; list-style:none;background:url('http://www.baidu.com/img/baidu_sylogo1.gif')"></li>
</ul>
</div>
</div>
</form>
</body>
</html>
kkbac 2011-08-30
  • 打赏
  • 举报
回复
css属性hover就可以了.
qianainan 2011-08-30
  • 打赏
  • 举报
回复
没问题啊,主要代码在js里就行了,O(∩_∩)O~
x363961461 2011-08-30
  • 打赏
  • 举报
回复
onmousemove的时候写个style outonmouse的时候写个style
就解决了
梦纷飞舞 2011-08-30
  • 打赏
  • 举报
回复
这个很简单的!!!
hua456 2011-08-30
  • 打赏
  • 举报
回复
可以实现。
danceboy_520 2011-08-30
  • 打赏
  • 举报
回复
这个是可以实现的
luqing200862 2011-08-30
  • 打赏
  • 举报
回复
如果你是想执行单击效果的话 加个<a href="#" target="_bank"><span>测试</span></a>

若不是 那就尝试 js 看有没有办法,,,,不过偶没这样做过,,
  • 打赏
  • 举报
回复
在鼠标点击图片时 --> 在鼠标在图片上移动时
  • 打赏
  • 举报
回复
简便的就在鼠标点击图片时计算:

event.pageX-this.offsetLeft;

event.pageY-this.offsetTop;

然后你来判断它偏大还是偏小。
MSDNXGH 2011-08-30
  • 打赏
  • 举报
回复
百度查一下JS特效,改变鼠标形状

那JS代码,一套套的,随你选
OnlyVB 2011-08-30
  • 打赏
  • 举报
回复
能不能用简单的代码实现呀,如果复杂的话就算了
andrewsway 2011-08-30
  • 打赏
  • 举报
回复
具体是那个容器的背景图片?放在容器上控制鼠标,就可以了
CalvinR 2011-08-30
  • 打赏
  • 举报
回复
这貌似只能用脚本实现
红魔大卫 2011-08-30
  • 打赏
  • 举报
回复
理论上可以实现,
OnlyVB 2011-08-30
  • 打赏
  • 举报
回复
楼上复杂了,想找个简便的
tengmingttmm 2011-08-30
  • 打赏
  • 举报
回复
[Quote=引用 16 楼 onlyvb 的回复:]
我的意思是用一个div做两个div的事,背景图片在右面,仅仅鼠标停留在背景图片的时候出现特殊的鼠标形状

类似那种一张图片点左边上翻,点右边下翻。现在就是要求在一个div上面显示的两种不同的鼠标形状,div大小不固定,背景图片大小是固定的,模拟图像热点好像比较复杂,有没有简单的,如果实现方法不简单,那还是使用两个div
[/Quote]
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

<!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 runat="server">
<title></title>
<style type="text/css">
#li1
{
cursor:help;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div style=" font-size:xx-large;width:400px; height:400px; background-color:Yellow;text-align:center;
padding-right:50px;">
<ul>
<li id="li1"
style=" width:276px; height:100px; list-style:none;background:url('http://www.baidu.com/img/baidu_sylogo1.gif')"></li>
</ul>
</div>
</form>
</body>
</html>





也是一个DIV实现的只是在这个DIV里面加入了UL 和 LI标签其实本质上来说也是算实现了一个DIV实现的2个不同鼠标指针。这算是目前来说一个DIV实现功能比较简单的方法了,至于其他的我就暂时不晓得了!
加载更多回复(3)

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧