本文實(shí)例講述了JavaScript實(shí)現(xiàn)重置表單(reset)的方法。分享給大家供大家參考。具體如下:
下面的代碼可以對(duì)表單內(nèi)的輸入數(shù)據(jù)進(jìn)行重置
<!DOCTYPE html><html><head><script>function formReset(){document.getElementById("frm1").reset();}</script></head><body><p>Enter some text in the fields below, then press the "Reset form" button to reset the form.</p><form id="frm1">First name: <input type="text" name="fname"><br>Last name: <input type="text" name="lname"><br><br><input type="button" onclick="formReset()" value="Reset form"></form></body></html>
希望本文所述對(duì)大家的javascript程序設(shè)計(jì)有所幫助。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注