CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
花落谁家,你作主! 盛大widget设计大赛英雄榜
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Web 开发 >  JavaScript

请问pixelTop和top有什么区别

楼主jhtisboy(容易受伤的男人)2002-04-10 10:36:52 在 Web 开发 / JavaScript 提问

问一下html元素中pixeltop和top,pixelleft和left  
  请问他们和元素的height,width有联系吗  
  另外screen.height和screen.availheight  
  screen.width和screen.availwidth  
  有什么区别  
  还有我怎么取屏幕的分辩率 问题点数:20、回复次数:11Top

1 楼net_lover(【孟子E章】)回复于 2002-04-10 11:22:40 得分 2

window.screen.Width  
  window.screen.HeightTop

2 楼8988(晓月)回复于 2002-04-10 11:25:17 得分 5

用window.document.body对象时  
  offsetWidth、offsetHeight         IE工作区宽和高  
  clientWidth、clientHeight         IE可见区宽和高  
  scrollWidth、scrollHeight         IE水平滚动板宽度和垂直滚动板高度  
   
   
  screen.width、screen.height     屏幕的分辩率  
  Top

3 楼net_lover(【孟子E章】)回复于 2002-04-10 11:25:18 得分 4

top的值是String  
  pixelTop的值是IntegerTop

4 楼net_lover(【孟子E章】)回复于 2002-04-10 11:25:31 得分 0

top的值是String  
  pixelTop的值是IntegerTop

5 楼karma(无为MS MVP)回复于 2002-04-10 11:28:36 得分 4

left   (x),top   (y)是带单位的值,pixelLeft,pixelTop是不带单位的值  
   
  屏幕的分辩率(单位是pixel):  
  screen.width  
  screen.height  
   
  screen.availWidth,   screen.availHeight是指除去TASKBAR以外的长宽  
   
   
  Top

6 楼zlgun(自由人)回复于 2002-04-10 11:38:13 得分 3

这是msdn对pixelTop的解释  
  The   pixelTop   property   reflects   the   value   of   the   Cascading   Style   Sheets   (CSS)   top   attribute.   Use   the   offsetTop   property   to   calculate   actual   positions   within   the   document   area.  
   
  Unlike   the   top   property,   the   pixelTop   value   is   an   integer,   not   a   string,   and   is   always   interpreted   in   pixels.  
   
  Because   the   value   of   the   top   property   is   a   string,   you   cannot   use   the   property   in   script   to   calculate   the   position   of   the   object   in   the   document;   instead,   use   the   pixelTop   or   the   posTop   property.  
   
   
  pixelleft和left的关系也是如此(类型不同)  
   
  screen.width和screen.height返回的就是屏幕的分辩率  
  screen.availwidth和screen.availheight指的是系统屏幕工作区域的宽度和高度,不包括任务栏(Retrieves   the   width   and   height   of   the   working   area   of   the   system's   screen,   excluding   the   Microsoft   Windows   taskbar.   )  
  当你把任务栏设为自动隐藏时screen.availwidth和screen.availheight的值与screen.width和screen.height相同Top

7 楼jhtisboy(容易受伤的男人)回复于 2002-04-10 12:38:43 得分 0

请问一下pixeltop是相对于父对象的吗  
  比如我在一个层中嵌套了一个层  
  那么子层的pixeltop是相对于父层的吗Top

8 楼zlgun(自由人)回复于 2002-04-10 13:51:59 得分 2

yes  
  pixeltop是相对于父层的  
  Top

9 楼jhtisboy(容易受伤的男人)回复于 2002-04-10 14:41:18 得分 0

请问一个页面中我嵌套在不同层中的两个子层能不能用同一个idTop

10 楼zlgun(自由人)回复于 2002-04-10 15:22:06 得分 0

The   id   should   be   unique   throughout   the   scope   of   the   current   document.   If   a   document   contains   more   than   one   object   with   the   same   identifier,   the   objects   are   exposed   as   a   collection   that   can   be   referenced   only   in   ordinal   position  
   
  自己翻译一下吧,这是MSDN上的原话Top

11 楼jhtisboy(容易受伤的男人)回复于 2002-04-10 16:40:25 得分 0

我现在有一个图,可以看成一个小按钮,我想让他停在层中的一个地方  
  请问如何写Top

相关问题

  • 什么区别?
  • 有什么区别?
  • 有什么区别?
  • WINODOWS中的topmose窗口跟top-level窗口有什么区别
  • show, showmodal有什么区别?
  • ->和.有什么区别
  • BYTE 和 byte 什么区别??
  • :=和=的区别是什么?
  • fopen与_open什么区别?
  • ShellExecute,WinExec有什么区别?

关键词

  • 屏幕
  • top
  • ie
  • pixeltop
  • screen
  • 单位
  • 屏幕的分辩率
  • height
  • width
  • property

得分解答快速导航

  • 帖主:jhtisboy
  • net_lover
  • 8988
  • net_lover
  • karma
  • zlgun
  • zlgun

相关链接

  • Web开发类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo