Tôi cần tạo nút đặt lại khi nhấp sẽ đặt tất cả các danh sách chọn trong biểu mẫu thành chỉ mục 0. Tôi đã thử mã này cho hàm, nhưng nó đưa ra lỗi cú pháp trên myForm. chiều dài;Javascript để chọn tùy chọn đầu tiên của danh sách lựa chọn
<script type="text/javascript">function ResetForm(form) {
var myForm = document.forms[form];
for(var i=0; i < myForm.length; i++){
myForm.select[i].selectedIndex =0; } }
</script>
selectElement.selectedIndex = 0; – danday74