html頁面高度自適應,html頁面自適應

來源:互聯網
上載者:User

html頁面高度自適應,html頁面自適應

本文實現的效果是根據瀏覽器解析度的不同,頁面底端背景色自適應瀏覽器高度,也就是可以自動填滿背景色。

<script type="text/javascript">

function height_adaptive(){
  var main=$(document).height();
  var title=document.getElementById("login_title").scrollHeight;
  var body=document.getElementById("login_body").scrollHeight;
  var bottom=main-title-body;
  $("#login_bottom").height(bottom);
 }
  </script>

 

<BODY id="userlogin_body" onload="height_adaptive()">

<form  method="post" action="login.action" name="frm" id="frm">
  <div id="login_title" class="login_title">
 <span id="lbl_title">mindray | OR Digital System</span>
  </div>
  <div id="login_body" align="center" class="login_body">
  <div align="left" class="login_head">
  <img id="logo" alt="" src="./images/web/login_logo.png">
 </div>
 <table cellspacing="10px" style="padding-top:278px">
  <tr>
   <td><input type="text" id="userNameTest" name="tuser.username" onblur="showpasssword()" style="background:#FFFFFF url(images/web/user_available.png) no-repeat;" /></td>
  </tr>
  <tr>
   <td><input type="password" id="usrpwdTest" name="tuser.password" style="background:#FFFFFF url(images/web/pwd_available.png) no-repeat;" /></td>
  </tr>
  <tr>
   <td align="left"><img id="remember" alt="" src="images/web/ck_unselect.png" onmouseover="rem_mouseover()" onmouseout="rem_mouseout()"
     onmousedown="rem_mousedown()" onmouseup="rem_mouseup()">
   <span id="lbl_remember">&nbsp;Remember me</span></td>
  </tr>
 </table>
  </div>
  <div id="login_bottom" align="center" class="login_bottom">
 <br />
 <button type="button" id="btn_login" onclick="check()" onmousedown="login_mousedown()" onmouseup="login_mouseup()">Log in</button>
  </div>

</FORM>
</BODY>

 

 

 

著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.