reload的时候使用get提交,而不用post,在提交的时候也不使用document.location.reload(),
而是直接写document.location.href=""在多加个参数,这样判断是否接收到这个参数来确认是否是刷新还是第一次进入该网页,来区分readOnly

解决方案 »

  1.   

    function changetype()
    {
    var a = document.uploadform.belongto;
    a.disabled = a.disabled == true ? false : true;
    }
      

  2.   

    <script language="javascript">
    function changetype()
    {
    if(document.forms[0].type[1].checked)
    {
    document.forms[0].belongto.disabled=false;
    document.forms[0].projectname.disabled=true;
    }else
    {
    document.forms[0].belongto.disabled=true;
    document.forms[0].projectname.disabled=false;
    }
    }function init()
    {
    if(document.forms[0].type[1].checked)
    {
    document.forms[0].belongto.disabled=false;
    document.forms[0].projectname.disabled=true;
    }
    }
    </script>
      

  3.   

    matrixy(处女主任[走召纟及犭孟男 上厕所不关门,上完不擦P股]) 
    你的方法可行,可是为什么我写的不可行啊,不是一样的么?hbhbhbhbhb1021(天外水火(我要多努力)) ( 三星(高级)) 你说的我不太懂he_8134(只有星星伴明月) ( 五级(中级)你把readonly改成disabled我用readonly前就是用的disabled但是也不行。不知道为什么matrixy的可行
      

  4.   

    我在ie6跟ff上试过可以才贴上来的~~~
      

  5.   

    那你就用disabled吧,嘿嘿,刚刚我就是试readOnly半天不行就换了下disabled这个了..都一样的.
    你的问题可能在于你没有写上else语句(你的代码我没细看 ^_^ )
      

  6.   

    这样改就好了注:1.切换的时候要用true和false不要加引号,要求是Boolean 类型;
    2.select没有readonly,只有disabled,另外disabled=true的对象,在提交表单的时候不会提上去。<html>
    <head>
    </head>
    <script language="javascript">
    function changetype()
    {if(document.forms[0].type[1].checked)
    {
    document.forms[0].belongto.disabled=false;
    document.forms[0].projectname.readOnly=true;
    }
    if(document.forms[0].type[0].checked)
    {
    document.forms[0].belongto.disabled=true;
    document.forms[0].projectname.readOnly=false;
    }
    }function init()
    {
    if(document.forms[0].type[1].checked)
    {document.forms[0].belongto.enabled="true";
    document.forms[0].projectname.readOnly="true";
    }
    }
    </script>
    <body bgcolor="#66FF99" onload="init()">
    <h1>文件上传</h1>
    <form name="uploadform" method="POST" action="/SoftwareReuseLibrary/FileUpload" ENCTYPE="multipart/form-data">
            <table border="1"  cellpadding="4" width="800" cellspacing="2" bordercolor="#9BD7FF" align="center">
    <tr>
    <td>
    <input type ="radio" name="type"  value="new" onclick="changetype()">新项目上传</input>
    <input type ="radio" name="type"  value="update" checked onclick="changetype()">更新已有项目</input>
     </td>
    </tr>
    <tr>
    <td>新项目名称:<input type="text" name="projectname"/></td>
    </tr>
    <tr>
    <td>
    请选择上传文件所属的项目:
    <select name="belongto">
    <option value="null" selected="selected">----------</option>
    <option value="1">111111</option>
    </select>
    </td>
    </tr>        <tr><td colspan="2">
                           请选择你需要上传的文件:<input name="x" size="40" type="file"/>
            </td>
    </tr><tr>
    <td>
    文件功能描述:<br/>
    <textarea name="fd" cols="50" rows="20"></textarea>
    </td></tr><tr><td>
    作者:<input type="text" name="author"/></td></tr>
            <tr><td align="center"><input name="upload" type="submit" value="开始上传"/></td></tr>
           </table>
    </form>
    </body>
    </html>
      

  7.   

    document.forms[0].projectname.readOnly=true; //别用字符串型,用boolean型
    document.forms[0].projectname.readOnly=false;