Js gets the input length and sets its size and center alignment according to the page width
- 2020-03-30 03:43:58
- OfStack
1. Js to get the page width, height and screen resolution
Page visible area width: document.body.clientWidth
High visibility area: document.body.clientHeight
Page visible area width: document.body.offsetWidth ( Including the width of the edges )
High visibility area: document.body.offsetHeight ( Including the width of the edges )
Full text width: document.body.scrollWidth
Full text of the web page: document.body.scrollHeight
Pages are scroll down high: document.body.scrollTop
Page scroll to the left: document.body.scrollLeft
On the body of the page: window.screenTop
Page body part left: window.screenLeft
High screen resolution: window.screen.height
Width of screen resolution: window.screen.width
Screen available workspace height: window.screen.availHeight
Screen available workspace width: window.screen.availWidth
2. Js gets the input length
document.getElementById("input the id value ").style.width = document.body.scrollWidth * 0.24 - 550;
3. Center align the input box
<input type="text" style="text-align:center;" />