Use jquery to adapt browser-wide controls to browser size
First, add a reference to jquery in
<script type= "Text/javascript" src= "Http://ajax.microsoft.com/ajax/jquery/jquery-1.4.min.js" ></script >
Add methods in JS Window.onresize and window.onload The method is a system function and is called automatically when there is a trigger.
<script type= "Text/javascript" > window.onresize = function () { var Width = document.body.offsetwidth;// Read the browser's wide //document.getelementbyid ("ChartData"). width = width; $ ("#ChartData"). CSS ({"width": width.tostring () + "px"});//use jquery to adjust the width of the control document.getElementById ("Show_size") . InnerHTML = width + " " + document.body.offsetheight;//display current browser width //alert (document.getElementById ("Show_size "). value); chartframe//loading page is called } window.onload = window.onresize;</script>
Another way to read the browser size is as follows:
Gets the window width if (window.innerwidth) Winwidth = Window.innerwidth;else if ((document.body) && ( document.body.clientWidth)) Winwidth = document.body.clientwidth;//Gets the window height if (window.innerheight) Winheight = Window.innerheight;else if ((document.body) && (document.body.clientHeight)) Winheight = document.body.clientheight;//detects the body by deep inside the Document and gets the window size if (document.documentelement && Document.documentElement.clientHeight && document.documentElement.clientWidth) {winheight = Document.documentelement.clientheight;winwidth = Document.documentElement.clientWidth;}
With:
Use jquery to adapt browser-wide controls to browser size