javascript:if form1.checkbox.checked=ture then
form1.text.value=""
form1.text.disable=""

解决方案 »

  1.   

    晕!你会disable不会readonly??????
    <input type="checkbox" onclick="ys.readOnly=!ys.readOnly" ><input id="ys" />
      

  2.   

    disable用了,页面上就没有该input了
      

  3.   

    <input type=checkbox onclick="meizz.readOnly=checked">只读?
    <input name=meizz value=meizz><input type=checkbox onclick="btn.disabled=checked">不可用?
    <input type=button name=btn value=meizz>
      

  4.   

    <input type=text id="HH">
    <input type=button onclick="document.all.HH.readOnly='true';">
      

  5.   

    看看这个行不?
    <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title> New Document </title>
    <meta name="Generator" content="EditPlus">
    <meta name="Author" content="">
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    </head><body bgcolor="#FFFFFF">
    <table>
     <tr>
      <td><input type="checkbox" name="chbox" onclick="rd.readOnly = true">readonly</td>
      <td><input type="text" id="rd" value="readonly"></td>
     </tr>
     <tr>
      <td><input type="checkbox" name="chbox" onclick="db.disabled = true">disabled</td>
      <td><input type="text" id="db" value="disabled"></td>
     </tr>
     <tr>
      <td><input type="checkbox" name="chbox" onclick="hd.style.display = 'none'">hidden</td>
      <td><input type="text" id="hd" value="hidden"></td>
     </tr>
     
    </table>
    </body>
    </html>
      

  6.   

    感谢大家的指点。因为说过不用disable属性,主要想了解的是readonly的参数。原来用“meizz(梅花雪)”的方法,加!checked参数就行。
    xinyunyishui(心云意水)/gjd111686(数字金刚) 的方法单独用可以,但结合在代码里就不行。也未报错,如下,谁能指点下:
    <form name='inputip' id='inputip'>
    <input id='nowip' name='nowip' type='text' value='111.111.111.111' size="25" readonly> 新IP<input type='checkbox' name='mine' onclick="javascript:if(this.checked==true){document.all.inputip.nowip.value='';document.all.inputip.nowip.readOnly='false';} else {document.all.inputip.nowip.value='111.111.111.111';document.all.inputip.nowip.readOnly=checked}">
    </form>
      

  7.   

    <form name='inputip'>
    <input name='nowip' type='text' value='111.111.111.111' size="25" readonly>
    新IP<input type='checkbox' name='mine' onclick="javascript:if(this.checked){with(document.inputip.nowip){value='';readOnly=false;}} else {with(document.inputip.nowip){value=defaultValue;readOnly=true;}}">
    </form>readOnly='false';  //false 是关键字, 不需要引号的
      

  8.   

    xinyunyishui(心云意水)的方法:<form name='inputip' id='inputip'>
    <input id='nowip' name='nowip' type='text' value='111.111.111.111' size="25" readonly> 新IP<input type='checkbox' name='mine' onclick="javascript:if(this.checked==true){document.all.inputip.nowip.value='';document.all.inputip.nowip.readOnly=!document.all.inputip.nowip.readonly;} else {document.all.inputip.nowip.value='111.111.111.111';document.all.inputip.nowip.readOnly='true'}">
    </form>
    不知我用对了么。下载过的JS资料对网页控件方面的介绍也少。谁有好的资料吗?
      

  9.   

    楼主好了<form name='inputip' id='inputip'>
    <input id='nowip' name='nowip' type='text' value='111.111.111.111' size="25" readonly> 新IP<input type='checkbox' name='mine' onclick="javascript:if(this.checked==true){document.all.inputip.nowip.value='';document.all.inputip.nowip.readOnly=false;} else {document.all.inputip.nowip.value='111.111.111.111';document.all.inputip.nowip.readOnly=true}">
    </form>注:想要给readOnly付值 true 或 false 时,不要给它们加引号,它不是一个字符串.
    还有"readOnly=checked"(这个东西我没用过),对text框不起做用,我想它只适用于check 框和radio吧