————————————————————————————

<script type="text/javascript">
            //初始化表单里的所有控件的值到最初状态
            function init(){
                var f = document.forms[0];        //获取表单DOM
                f.reset();                    //使用reset()函数
            }
        </script>

————————————————————————————

<body style="text-align:center">
        <!-- 定义表单 -->
        <form>            
            文本框:<input type="text" name="myText"/>
            <br/>
            单选框:<input type="radio" name="myRadio" value="1"/>
            <input type="radio" name="myRadio" value="2"/>
            <br/>
            下拉列表:
            <select name="mySelect">
                <option value="">==请选择==</option>
                <option value="1">1</option>
                <option value="2">2</option>
            </select>
            <br/>
            <input type="button" value="初始化" onclick="init()"/>
        </form>
    </body>

——————————————————————————————

 

相关文章:

  • 2021-12-24
  • 2021-09-06
  • 2021-12-31
  • 2021-04-27
  • 2021-05-17
  • 2022-12-23
  • 2021-08-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-15
相关资源
相似解决方案