请问wujinbao(飞扬草) 如何将一个层位置,固定在一个表格的单元格内,能说的详细一些么?最好能给个例子。

muly 2002-01-22 12:39:01
...全文
72 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
孟子E章 2002-01-22
  • 打赏
  • 举报
回复
<table border=1 id=table1>
<tr>
<td id=td1>
<div id=div1 style="position:relatvie;width:100;height:100;background-color:red"><p>test</p><p>test</p><p>test</p><p>test</p></div>
</td>
</tr>
</table>
mosane 2002-01-22
  • 打赏
  • 举报
回复

把 <div id="Layer1" style="position:absolute; width:357px; height:8px; left:57px; visibility: visible; z-index:1; top: 139px; border: 1px none #000000; background-color: #00FF00; layer-background-color: #00FF00" > 中的
absolute(表示绝对)改成 relatvie(代表相对)就行了。

vincentmax 2002-01-22
  • 打赏
  • 举报
回复
偶来晚了
wujinbao 2002-01-22
  • 打赏
  • 举报
回复

<html>
<head>
<title>title</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000" ><center>
<form name="frm" action="" method="post" >
<table width="760" cellpadding="0" cellspacing="0" border="1" class="titlesty" id="tb1">
<tr >
<td height="29" nowrap valign="middle">  </td>
</tr>
<tr>
<td id="td1" height="18" nowrap bordercolor="#FFFFFF" valign="middle">  
<div id="Layer1" style="position:absolute; width:357px; height:8px; left:57px; visibility: visible; z-index:1; top: 139px; border: 1px none #000000; background-color: #00FF00; layer-background-color: #00FF00" >
当前层的位置</div>
</td>
</tr>
</table>
<script language="JavaScript">
document.all.Layer1.style.pixelLeft = document.all.td1.offsetLeft + document.all.tb1.offsetLeft+10;
document.all.Layer1.style.pixelTop = document.all.td1.offsetTop + document.all.tb1.offsetTop+1;
</script>
</form>
</center>
</body>
</html>

87,904

社区成员

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

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