点击一个按钮出现一个层,这个层要在按钮的边上(不管分辨率是多少),如何实现?

ocool 2003-08-30 09:06:56
如题
...全文
27 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
fason 2003-08-30
  • 打赏
  • 举报
回复
you should get the absolute position of the button first
孟子E章 2003-08-30
  • 打赏
  • 举报
回复
<center><input type=button onclick="aaa(this)"><br>
<input type=button onclick="aaa(this)">
<div id=a2 style="visibility:hidden;position:absolute"><input value="ok"><input value="ok"><input value="ok"><input value="ok"></div>

<script>
function aaa(o)
{
document.getElementById("a2").style.left = o.offsetLeft+o.offsetWidth
document.getElementById("a2").style.top = o.offsetTop + o.offsetHeight
document.getElementById("a2").style.visibility='visible'
return false
}
</script>

61,110

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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