没有啊,我在一个页面中用了iframe啊,所以我的表单界面还在啊,我要让别人继续录入啊,所以想清空表单里的内容了!

解决方案 »

  1.   

    是不是这个东西<SCRIPT language="javascript">
    function test()
    {
    var form = document.forms[0];
    for(var i=0; i<form.elements.length; i++)
    {
    if(form.elements[i].type== "text" )
    form.elements[i].value = "";
    else if(form.elements[i].type=="checkbox")
    form.elements[i].checked = false;
    else if(form.elements[i].type=="radio")
    form.elements[i].checked = false;
    }
    }
    </SCRIPT>
    <BODY>
    <FORM>
    <INPUT id="txt">
    <INPUT id="txt1">
    <INPUT id="txt2">
    <INPUT type="checkbox" id="ch1">
    <INPUT type="checkbox" id="ch2">
    <INPUT type="radio" name="ra1">
    <INPUT type="radio" name="ra1">
    <INPUT type="button" onClick="test()" value="test"/>
    </FORM>
    </BODY>
    </HTML>
      

  2.   

    最好把你的HTML源码贴出来form1.reset(); //清空表单里的内容
    form1.oTxtInput1.foucs(); //设置控件取得焦点
      

  3.   

    <form name="myform" onsubmit="alert ('提交了!');jd(this);return(false)">
    <input type=text value="CSDN">
    <input type=text value="">
    <input type=checkbox checked>
    <input type=reset value="恢复缺省设置">
    <input type=submit value="提交">
    </form>
    <script>
    function jd(obj){
      var obj_form=obj.getElementsByTagName("input")
      if (obj_form.length) obj_form[0].focus()
    }
    </script>
      

  4.   

    <script language="JavaScript">
    <!--
    var newWindow = null
    function windowOpener(loadpos)
    {
      newWindow = window.open(loadpos,'opswindow','toolbar,resizable=0,scrollbars=0,status=yes,toolbar=no,location=no,menu=no,width=790,height=525,top=0,left=0');
    newWindow.focus();
    }
    function clearpass1(){
    document.form1.username.value="";
    document.form1.password.value="";
            document.form1.username.focus()
    }
    //-->
    </script><form name="form1" method="post" action="login.asp" onSubmit="windowOpener('');setTimeout('clearpass1()',100);" target="opswindow"><tr> 
        <td width="15%" height="34"> <div align="center"> 
              <input name="username" type="text" class="input" id="username" size="15" maxlength="15">
          </div></td>
        <td width="15%"> <div align="center"> 
              <input name="password" type="password" class="input" id="password" size="15" maxlength="15">
          </div></td>
        <td width="10%"><div align="center">
            <input name="Submit" type="submit" class="button" value="登录">
            <input name="Submit2" type="reset" class="button" value="清除">
          </div></td>
        <td width="40%">&nbsp;
          <a href="#">取回密码</a> 修改密码</td>
        <td width="10%">&nbsp;</td>
      </tr></form>
      

  5.   

    <input type=text onFocus="javascript:this.select();">这个就可以