1。JSページの幅と高さと画面解像度を取得します
Webページの可視領域の幅:document.body.clientWidth Webページの可視領域の高さ:document.body.clientheight Webページの可視領域幅:document.body.offsetwidth(エッジラインを含む)Webページの可視領域の高さ:document.body.body.offsetheight(document.body.offsetheigh(widthe)firth.fulle the width.ページテキストフルテキストの高さ:document.body.scrollheight Webページロールアウェイ高さ:document.body.body.scrolltop Webページ左:document.body.scrollleft Webページテキストパーツ:window.screentop Webページテキスト部品左:window.screenleft画面解像度の高さ:window.screen.screen.height screen worksepace heaws使用可能なワークスペース幅:window.screen.availwidth
2。JS入力長を取得します
document.getElementByID( "入力ID値")。style.width = document.body.scrollwidth * 0.24-550;
3。入力ボックスを中央に配置します
<input type = "text" style = "text-align:center;" />