获取div 相对 父div 的位置 本帖最后由 lzgctgc 于 2011-08-22 13:57:55 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <div style="height: 400px; overflow: auto;" id="DivContent" onscroll="TalkReadState()"> <table class="TalkFormClass"> <tr> </tr> </table> <table class="TalkFormClass"> <tr> <td> </td> </tr> </table> <table id="dlReplyTalk" cellspacing="0" border="0" style="border-width: 0px; width: 100%; border-collapse: collapse;"> <tr> <td style="width: 100%;"> <table class="TalkFormClass"> <tr id='23Content' style="display: block"> <td style="background-color: #ffffff;"> <div class="TalkLoadContent" id='loadReply23' style="display: block"> <span style='color: #A9A9A9;'>回复内容加载中...</span><script type="text/javascript">SetTalkReplySysID('23','0')</script></div> <div id='showReply23' style="display: none" title='0$23'> </div> </td> </tr> </table> </td> </tr> </table></div>我简化了页面,showReply23 相对 DivContent 的距离 <div style="height: 400px; overflow: auto;" id="DivContent" onscroll="TalkReadState()"> <table class="TalkFormClass"> <tr> </tr> </table> <table class="TalkFormClass"> <tr> <td> </td> </tr> </table> <table id="dlReplyTalk" cellspacing="0" border="0" style="border-width: 0px; width: 100%; border-collapse: collapse;"> <tr> <td style="width: 100%;"> <table class="TalkFormClass"> <tr id='23Content' style="display: block"> <td style="background-color: #ffffff;"> <div class="TalkLoadContent" id='loadReply23' style="display: block"> <span style='color: #A9A9A9;'>回复内容加载中...</span><script type="text/javascript">SetTalkReplySysID('23','0')</script></div> <div id='showReply23' style="display: none" title='0$23'> </div> </td> </tr> </table> </td> </tr> </table></div> var t1=document.getElementById("DivContent").style.top;var t2=document.getElementById("showReply23").style.top;alert( parseInt(t2)- parseInt(t1)); 非IE浏览器下,addEventListener有效监听JS赋值的输入框值变化 jquery问题求教(实现一个div层的动态效果) jquery treeview插件在叶子结点下再添加一个结点为什么无法伸缩呢 点击左侧内容 右侧内容改变 这两种javascript的用法,哪种好? 复选框,每行只能单选,选择完以后计算 如何强制输入数字???在线等。。。 页面刷新问题 急问想实现点击后改变属性,请问怎么改? javascript在 Mozilla 中不能工作,是为什么???????? js关于索引的问题。希望不要沉,希望好多人回答,希望标题短一点 js 方法调用
<table class="TalkFormClass">
<tr>
</tr>
</table>
<table class="TalkFormClass">
<tr>
<td>
</td>
</tr>
</table>
<table id="dlReplyTalk" cellspacing="0" border="0" style="border-width: 0px; width: 100%;
border-collapse: collapse;">
<tr>
<td style="width: 100%;">
<table class="TalkFormClass">
<tr id='23Content' style="display: block">
<td style="background-color: #ffffff;">
<div class="TalkLoadContent" id='loadReply23' style="display: block">
<span style='color: #A9A9A9;'>回复内容加载中...</span><script type="text/javascript">SetTalkReplySysID('23','0')</script></div>
<div id='showReply23' style="display: none" title='0$23'>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>我简化了页面,showReply23 相对 DivContent 的距离
<table class="TalkFormClass">
<tr>
</tr>
</table>
<table class="TalkFormClass">
<tr>
<td>
</td>
</tr>
</table>
<table id="dlReplyTalk" cellspacing="0" border="0" style="border-width: 0px; width: 100%;
border-collapse: collapse;">
<tr>
<td style="width: 100%;">
<table class="TalkFormClass">
<tr id='23Content' style="display: block">
<td style="background-color: #ffffff;">
<div class="TalkLoadContent" id='loadReply23' style="display: block">
<span style='color: #A9A9A9;'>回复内容加载中...</span><script type="text/javascript">SetTalkReplySysID('23','0')</script></div>
<div id='showReply23' style="display: none" title='0$23'>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
var t2=document.getElementById("showReply23").style.top;
alert( parseInt(t2)- parseInt(t1));