Link to home
Start Free TrialLog in
Avatar of Chris_m
Chris_m

asked on

window.history.back(-1) question

I have a text input box in a form which, when the submit button is pressed, calls an ASP page for processing.  When the processing is complete,  I use window.history.back(-1) to go back to the page with the form, is there any  way that I can have the text input box automatically clear its contents when it is displayed again?
Avatar of ianlesoft
ianlesoft

yes, you can use ASP command "expire" of the page
Just replace the streings with the correct names

function document_onload()
{
   document.forms["formname"]["textboxname"].value="";
}

window.onload=document_onload;

Regards,
CJ
Avatar of Chris_m

ASKER

For ianlesoft:
I am not sure how to ue the expire command
for CJ S:
that would work fine except that the Input box is initially populated with a value obtained from a SELECT box on another ASP page
<INPUT ID="NameAfterChange" NAME="selectedName" VALUE="<%Response.Write(Request.Form("selectedName"))%>">
and if I use your code, the initial value is also cleared.  I only want the box to be cleared when I return to it, not when I initialy go to it.
regards
ASKER CERTIFIED SOLUTION
Avatar of CJ_S
CJ_S
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial