问题解决:
<input type="text" name="test" onkeyup="aaa(test)"></input>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
function aaa(a) {
if (a.value.length==4){
a.value= a.value+"-"
}
}
</script>
送分。。10分钟后结贴。
来者有分。

解决方案 »

  1.   

    这个如何?<SCRIPT LANGUAGE="JavaScript"> <!-- Begin 
    function call_me(max_length) { 
    if((document.form1.mybox.value == null ) || (document.form1.mybox.value == "" )) document.form1.mybox.size = size; 
    if((document.form1.mybox.value.length >= size)&&(document.form1.mybox.value.length <= max_length)) document.form1.mybox.size = document.form1.mybox.value.length + 1; 
    else document.form1.mybox.size = size; 

    // End --> 
    </script> <form name="form1"> 
    内容: <input type="text" style="font-family: Terminal" name="mybox" maxlength="50" size="10" onFocus="setInterval('call_me(document.form1.mybox.maxLength)', 1)"> 
    <!--/style needs to be a font that has a fixed size attribute like TERMINAL/--> 
    </form> <SCRIPT LANGUAGE="JavaScript"> 
    <!-- Begin 
    var size = 10
    // End --> 
    </script>
      

  2.   

    提示:document.form1.mybox为空或不是对象。
    看一看。应该很快可以跳通的。。可惜我没什么时间。。呵呵。。不
    理了。。有时间在看看你的程序。