<!DOCTYPE html> <html> <body> <input size="20" maxlength="2"> <script> document.body.offsetWidth; document.getElementsByTagName("input")[0].setAttribute("value", "abcde"); </script> </body> </html>