用script在input的ondownup中测出input中的字符长度,再动态更改input的size

解决方案 »

  1.   

    <form name="form1">
      <input type="text" name="go" size="20" onchange="form1.go.size=(form1.go.value.length)" >
    </form>汉字还有点问题,原理已经出来了!
      

  2.   

    <form name="form1">
      <input type="text" name="go" size="20" onkeyup="form1.go.size=(form1.go.value.length)" >
    </form>
    ok
      

  3.   

    <input type=text onkeydown="this.size = this.value.length">我的不长哦,给我好了~
      

  4.   

    哈哈,不对,size这个属性不可以为0的,如果不定义最开始一下会提示出错,用哪个事件会比较好呢~
      

  5.   

    <input type=text size=1 onkeypress="this.size=this.value.length+1">
    我没看诸位的。
      

  6.   

    现在公布答案:中午给分,对答案有意见者尽管提!!
    问题1:答案:<input style="overflow-x:auto;height:20px">,请输入文字验证一下吧!!:)
    问题2:答案:<input style="overflow:visible">,请输入文字验证一下吧!!:)
    问题3:答案:<a href="http://lucky.myrice.com" target="_search">在“搜索”窗口里打开页面</a>