注意大小写: form.elements("name1").readOnly = true;readonly => readOnly

解决方案 »

  1.   

    还有一种比较笨的方法:
    <input name="txt" onKeypress="event.returnValue=false;">
      

  2.   

    上次花了200分问了个maxLength(我写成maxlength),
    这回你也一样,readOnly,
    在输入匡里面这个要求不严格,但是在做属性的时候,要求是严格的!
      

  3.   

    <html>
    <head>
    <title></title>
    <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    <script language="javascript">
    function pk(){
    var inputValue=document.all("myValue").value;
    document.myForm.Text1.value=inputValue;
    }


    </script>
    </head>
    <body>
    <form name="myForm"> 
    <input type="text" name="myValue" >
    <input type="button" value="测试"  onclick="pk()">
    <INPUT id="Text1" type="text" name="Text1" value="只读" readonly="true" >
    </form>
    </body>
    </html>
      

  4.   

    晕了,这么简单的。<input type="text" readonly>
    如果把颜色也变一下的话
    <input type="text" readonly style="background-color:buttonface">
    这样就比较象应用程序中的只读了。
      

  5.   

    <input type="text" readonly>
      

  6.   

    readonly => readOnly
      

  7.   

    啊!不会吧!那么简单!还是csdn高人多!多谢谢谢谢谢谢谢各位救命之恩!!!!撒分!撒分!听说jb是不推荐使用readOnly,所以颜色没有变,而且在jscript中也没说明,真是害苦大家了