양식 재설정

1727 단어 양식
방식 1:

    <script type="text/javascript">
        function reset() {
            var form = document.searchForm;
            for (var i = 0; i < form.elements.length; i++) {
                var field = form.elements[i];
                var fieldType = form.elements[i].type.toLowerCase();
                if (fieldType != "submit" && fieldType != "reset" && fieldType != "button" && fieldType != "hidden") {
                    if (fieldType == "radio" || fieldType == "checkbox") {
                        field.checked = false;
                    } else if (fieldType == "select") {
                        field.selected = false;
                    } else {
                        field.value = "";
                    }
                }
            }
        }
    </script>
<form name="searchForm" action="/helpServletTeacher" method="POST">
	<span> :</span>
	<select name="status" id="status">
	    <option value=""> </option>
	    <option value="-2"> </option>
	    <option value="-1"> </option>
	    <option value="1"> </option>
	    <option value="2"> </option>
	</select> 
    <input type="button" name="input9" class="bn4" value=" " onclick="reset()"/>
</form>

좋은 웹페이지 즐겨찾기