获取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)); 怎么能把zTree插件和jQueryUI的Dialog结合起来呢? 我是菜鸟,帮我分析一下代码 想在FF2 FF3 FF4 分别测试网页,用啥测试工具好? 求助,当粘贴内容到一个textarea的时候,怎么先把粘贴的内容赋值变量A上? 在JavaScript中怎样调用C#代码 怎样用数组向select(下拉框)里添加item? HELP请求!非常急! 如何取消一个事件? (Javascript 参考手册【中英文版本】下载链接)里面有中文的吗? 【菜鸟求助】求一段点击修改变量的代码 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));