faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 14 people (43%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

Can I reset a text area without using a clear or reset button, but by using the submit button?

Apr 6th, 2008 19:58
ha mo, Steven Armstrong, j s,


Yes you can.
try something like:
onload = function() {
  myForm = document.forms['formname'];
  myForm.onsubmit = function() {
    /* execute the 'empty textarea' statement 1sec after the click on 
       submit so the content of the textarea is submited 
       before deleted */
    setTimeout('myForm[\'textareaname\'].value = \'\'), 1000);
    return true;
  };
};
hope this helps
regards
Steven
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com