how to validate character and number in one textbox in javascript
<p>The max size of textbox is given as 11. I want to print first 4 characters as alphabets and next 7 characters as numbers. Please give me a solution in javascript only.</p>

<pre><code>function Myfunction2() {
    var x2 = document.getElementById('text').value;
    var re = /^[A-za-z]+$/;
    for (i = 0; i &lt; 4; i++) {
        y = x2charAt(i);
        if (re.test(x2.value)) {
            alert("please enter char only");
        }
    }
}

function Myfunction() {
    var x = document.getElementById("text").value;
    for (i = 5; i &lt; 11; i++) {
        y = x.charAt(i);
        if (y == " " || isNaN(y)) {
            alert("not numeric");
        }
    }
}
</code></pre>
