코드 복사 코드는 다음과 같습니다. 获取页face宽島 <br> $.format = function (source, params) {<br> if (arguments.length == 1)<br> return function () {<br> var args = $.makeArray(arguments);<br> args.unshift(source);<br> return $.format.apply(this, args);<br> };<br> if (arguments.length > ; 2 && params.constructor != 배열) {<br> params = $.makeArray(arguments).slice(1);<br> }<br> if (params.constructor != Array) {<br> 매개변수 = [params];<br> }<br> $.each(params, function (i, n) {<br> source = source.replace(new RegExp("\{" i "\}", "g") , n);<br> });<br> 반환 소스;<br> };<br> /*------------以上是字符串format函数------ ----------*/<br> $(document).ready(function () {<br> $("button").click(function () {<br> var d=$( "#div1");<br> var txt = "";<br> txt = $.format("width(): {0}</br>", d.width());<br> txt = $.format("높이(): {0}</br>", d.height());<br> txt = $.format("내부 너비: {0}</br>", d.innerWidth());<br> txt = $.format("내부 높이: {0}</br>", d.innerHeight());<br> txt = $.format("외부 너비: {0}</br>", d.outerWidth());<br> txt = $.format("외부 높이: {0}</br>", d.outerHeight());<br> txt = $.format("outerWidth(true): {0}</br>", d.outerWidth(true));<br> txt = $.format("outerHeight(true): {0}< /br>", d.outerHeight(true));<br> txt = $.format("HTML文档宽島: {0}</br>", $(document).width());<br> txt = $.format("HTML문서 높이: {0}</br>", $(document).height());<br> txt = $.format("浏览器视口宽degree: {0} ", $(window).width());<br> txt = $.format("浏览器视구고도: {0}</br>", $(window).height());<br> /script><br></head><br><body><br> <br><div id="div1" style="height:auto;width:300px;padding:10px;margin:3px;border:1px solid blue;background-color:lightblue;"></div> <br><br/><button>Show current various sizes</button><p> <p><a href="http://4welove.taobao.com" target ="_blank">Mobile phone bill, Q coins, game recharge</a></p><br><p>width() - Returns the width of the element. </p><br><p>height() - Returns the height of the element. </p><br><p>The innerWidth() method returns the width of the element (including padding). The innerHeight() method returns the height of the element (including padding). The outerWidth() method returns the width of the element (including padding and borders). </p><br><p>outerHeight() method returns the height of the element (including padding and border). </p><br><p>outerWidth(true) method returns the width of the element (including padding, border and margin). </p><br><p>outerHeight(true) method returns the height of the element (including padding, border and margin). </p><br><p>Returns the height of the document (HTML document) $(document).height()</p><br><p>Returns the window (browser viewport) $( window).height()</p><br></body><br></html><br><br><br></p> </div>