//獲取form對象var form=document.getElementById('my_form'); //用戶名input對象user_name是對象的name屬性var userName=form.user_name; //用戶名清空userName.value=''; //用戶密碼input對象password是對象的name屬性var password=form.password; //用戶密碼清空password.value=”;