这几个属性是干什么的?

odie 2003-05-10 09:52:21
pixelLeft
scrollLeft
...全文
44 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
hillhero789 2003-05-10
  • 打赏
  • 举报
回复
用这段代码试试就知道啦
<form name="form1" method="post" action="">
<div align="center">
<textarea name="textarea" rows="10"></textarea>
<br>
<input type="button" name="button" value="按钮" onclick="alert(textarea.scrollTop);">
</div>
</form>

先直接按一下,按扭,然后再添加n行文字,使scroll出来,然后滚动一下scroll再按按钮,现在你肯定已经明白了!
心云意水 2003-05-10
  • 打赏
  • 举报
回复
啊!sorry!
我检讨~~~
scrollTop:垂直滚动条已经滚动的距离
scrollHeight:垂直滚动条总长度
scrollLeft:水平滚动条已经滚动的距离
scrollWeight:水平滚动条总长度

当时没看清楚,sorry~~
多谢Estyle(靳田)提醒!
孟子E章 2003-05-10
  • 打赏
  • 举报
回复
http://msdn.microsoft.com/workshop/author/om/measuring.asp

属性图解
孟子E章 2003-05-10
  • 打赏
  • 举报
回复
属性图解

http://msdn.microsoft.com/workshop/graphics/dhtmlpos.gif
Estyle 2003-05-10
  • 打赏
  • 举报
回复
心云意水的解释可能有问题。
根据我上面从HTMLREF.CHM里面摘抄的解释,scrollLeft应该是水平滚动条已经滚动的距离(元素左边界与可见部分的最左边的横坐标差),而不是总长度。
水平滚动条总长度应该是scrollWidth才对。
David2008 2003-05-10
  • 打赏
  • 举报
回复
不对吧,scroll好象是一个对象的客户区的最左边啊!
心云意水 2003-05-10
  • 打赏
  • 举报
回复
scrollLeft:水平滚动条的总长度(可见部分+不可见部分)
pixelLeft:相对于某点(一般是屏幕左上角)的水平距离。
Estyle 2003-05-10
  • 打赏
  • 举报
回复
pixelLeft

Sets or retrieves the left position of the element, in pixels. Unlike the left property, this property's value is an integer, not a string, and is always interpreted in pixels.

scrollLeft

Sets or retrieves the distance, in pixels, between the left edge of the element and the leftmost portion of the element that is currently visible in the window. This is equal to the horizontal distance that the content of the element has been scrolled.

87,988

社区成员

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

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