亚欧洲精品在线观看,窝窝影院午夜看片,久久国产成人午夜av影院宅,午夜91,免费国产人成网站,ts在线视频,欧美激情在线一区

java語言

如何使用JavaScript快速獲取頁面高度寬度

時間:2025-01-21 15:39:20 java語言 我要投稿
  • 相關推薦

如何使用JavaScript快速獲取頁面高度寬度

  如何使用JavaScript快速獲取頁面高度寬度呢?大家可以嘗試一下代碼的實現(xiàn),更多詳情請關注應屆畢業(yè)生考試網(wǎng)。

  /********************

  * 取窗口滾動條高度

  ******************/

  function getScrollTop()

  {

  var scrollTop=0;

  if(document.documentElement&&document.documentElement.scrollTop)

  {

  scrollTop=document.documentElement.scrollTop;

  }

  else if(document.body)

  {

  scrollTop=document.body.scrollTop;

  }

  return scrollTop;

  }

  /********************

  * 取窗口可視范圍的高度

  *******************/

  function getClientHeight()

  {

  var clientHeight=0;

  if(document.body.clientHeight&&document.documentElement.clientHeight)

  {

  var clientHeight = (document.body.clientHeight<document.documentElement.clientHeight)?docum

  ent.body.clientHeight:document.documentElement.clientHeight;

  }

  else

  {

  var clientHeight = (document.body.clientHeight>document.documentElement.clientHeight)?docum

  ent.body.clientHeight:document.documentElement.clientHeight;

  }

  return clientHeight;

  }

  /********************

  * 取文檔內(nèi)容實際高度

  *******************/

  function getScrollHeight()

  {

  return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);

  }

【如何使用JavaScript快速獲取頁面高度寬度】相關文章:

如何使用JavaScript實現(xiàn)頁面定時跳轉10-18

JavaScript如何獲取獲取當前年月日星期06-04

如何在Word中調(diào)整超過頁面寬度表格08-13

JavaScript如何獲取地址欄中傳遞參數(shù)10-06

如何使用firework設計網(wǎng)站頁面09-18

如何快速獲取2017年考研信息與資料08-08

如何使用JavaScript實現(xiàn)倒計時10-14

dedecms頁面獲取會員狀態(tài)的方法10-24

如何使用php獲取excel文件數(shù)據(jù)10-17