Home > Web Front-end > JS Tutorial > js gets the input length and sets its size and center alignment according to the page width_javascript skills

js gets the input length and sets its size and center alignment according to the page width_javascript skills

WBOY
Release: 2016-05-16 16:39:04
Original
1671 people have browsed it

1. js to get the page width, height and screen resolution

网页可见区域宽:document.body.clientWidth
网页可见区域高:document.body.clientHeight
网页可见区域宽:document.body.offsetWidth (包括边线的宽)
网页可见区域高:document.body.offsetHeight (包括边线的宽)
网页正文全文宽:document.body.scrollWidth
网页正文全文高:document.body.scrollHeight
网页被卷去的高:document.body.scrollTop
网页被卷去的左:document.body.scrollLeft
网页正文部分上:window.screenTop
网页正文部分左:window.screenLeft
屏幕分辨率的高:window.screen.height
屏幕分辨率的宽:window.screen.width
屏幕可用工作区高度:window.screen.availHeight
屏幕可用工作区宽度:window.screen.availWidth
Copy after login

2. js gets input length

document.getElementById("input的id值").style.width = document.body.scrollWidth * 0.24 - 550;
Copy after login

3. The input input box is centered

<input type="text" style="text-align:center;" />
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template