如何实现鼠标移到图片的左半部分显示“上一张”,右半部分显示“下一张”,点击进入下一张或上一张图片

andy0618 2010-02-26 11:48:28
如何实现鼠标移到图片的左半部分显示“上一张”,右半部分显示“下一张”,点击进入下一张或上一张图片


类似新浪的图片显示
...全文
813 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
shan1119 2010-02-26
  • 打赏
  • 举报
回复
<img src="Images/cunbg/2.gif" border="0" usemap="#1" style="CURSOR: hand; width:100px;height:100px;">

<map name="1">
<area shape="rect" coords="0,0,50,100" href="nongchang.asp?action=xuan&id=1" alt="left" onFocus="this.blur()">
<area shape="rect" coords="50,0,100,100" href="nongchang.asp?action=xuan&id=2" alt="right" onFocus="this.blur()">
</map>
lure2222 2010-02-26
  • 打赏
  • 举报
回复
用map你自己找找去吧,上边我也前写的。。
lure2222 2010-02-26
  • 打赏
  • 举报
回复

<img src="Images/cunbg/2.gif" border="0" usemap="#1" style="CURSOR: hand; ">

<map name="1">
<area shape="poly" coords="72,64,126,28,65,3,4,30" href="nongchang.asp?action=xuan&id=1" alt="上一张" onFocus="this.blur()">
</map>

andy0618 2010-02-26
  • 打赏
  • 举报
回复
从网上找了代码解决了
sohighthesky 2010-02-26
  • 打赏
  • 举报
回复
用js吧,还要改变鼠标的样式 呢
判断iE用
offsetX
其它用layerX
position要是relative或者absolute才能取到layerX
shan1119 2010-02-26
  • 打赏
  • 举报
回复
<img src="Images/cunbg/2.gif" border="0" usemap="#1" style="CURSOR: hand; width:100px;height:100px;">

<map name="1">
<area shape="rect" coords="0,0,50%,100%" href="nongchang.asp?action=xuan&id=1" alt="left" onclick="this.blur()">
<area shape="rect" coords="50%,0,100%,100%" href="nongchang.asp?action=xuan&id=2" alt="right" onclick="this.blur()">
</map>
andy0618 2010-02-26
  • 打赏
  • 举报
回复
可是图片的长度宽度是不定的啊

87,921

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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