Wednesday, February 2, 2011

Dynamically Increase The Size Of The TextBox Using JavaScript


<html>
<head>

    <script>
        function incr() {
            var len = document.getElementById('txt').value;
            document.getElementById('txt').style.width = 75 + len.length * 4 + 'px';
        }
    </script>

    <body>
        <input type='text' id='txt' onkeydown='incr()' style='width: 75px' />
    </body>
</html>

No comments :

Post a Comment