zoukankan      html  css  js  c++  java
  • JQuery学习之jQuery尺寸

    1.width()和height()方法:

    width():设置或返回元素的宽度(不包括内边距,边框或外边距)

    height():设置或返回元素的高度(不包括内边距,边框或外边距)

    $("button").click(function(){

      var txt="";

      txt+="Width: " + $("#div1").width() + "</br>";

      txt+="Height: " + $("#div1").height();

      $("#div1").html(txt);

    });

    2.innerWidth()和innerHeight()方法:

    innerWidth():返回元素的宽度(包括内边距)

    innerHeight():返回元素的高度(包括内边距)

    $("button").click(function(){

      var txt="";

      txt+="Inner " + $("#div1").innerWidth() + "</br>";

      txt+="Inner height: " + $("#div1").innerHeight();

      $("#div1").html(txt);

    });

    3.outerWidth()和outerHeight()方法:

    outerWidth():返回元素的高度(包括内边距和边框)

    outerHeight():返回元素的高度(包括内边距和边框)

    $("button").click(function(){

      var txt="";

      txt+="Outer " + $("#div1").outerWidth() + "</br>";

      txt+="Outer height: " + $("#div1").outerHeight();

      $("#div1").html(txt);

    });

  • 相关阅读:
    手机抓包方法
    IBM appscan 9.0破解版分享
    C#打开新页面
    双城记
    卸载趋势
    测试环境搭建
    C#常用函数→ASP.NET篇
    C#常用函数--通用篇
    读>>>>白帽子讲Web安全<<<<摘要→我推荐的一本书→1
    TCP/IP网络编程技术基础
  • 原文地址:https://www.cnblogs.com/hqutcy/p/5974551.html
Copyright © 2011-2022 走看看