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);

    });

  • 相关阅读:
    枚举
    泛型
    装箱和拆箱
    使用TryParse()来执行数值转换
    参数数组
    checked和unchecked转换
    字符串不可变
    TCC : Tiny C Compiler (2018-2-6)
    win10 下 protobuf 与 qt
    QWebView 与Js 交互
  • 原文地址:https://www.cnblogs.com/hqutcy/p/5974551.html
Copyright © 2011-2022 走看看