I have assign default value to a text box .But the user can enter new value and submit it.But when the user enter the back button.The value goes back to default value. the default value is assign in on load function in the body.I am currently using java , jsp and javascript. The date value is obtain using the following syntax.
function setFromDate(){
if (document.all.fromday.value ==“”){
<%
Calendar cal = new GregorianCalendar();
// Get the components of the date
int era = cal.get(Calendar.ERA); // 0=BC, 1=AD
int year = cal.get(Calendar.YEAR); // 2002
int month = cal.get(Calendar.MONTH)+1; // 0=Jan, 1=Feb, …
int day = cal.get(Calendar.DAY_OF_MONTH); // 1…
int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); // 1=Sunday, 2=Monday,
%> <%System.out.println(“month”+month);%>
if (‘<%=year%>’ < 1000)
{year+=1900;}
if (‘<%=month%>’<10)
{month=eval(“0”+month);}
if (‘<%=day%>’<10)
{day=eval(“0”+day);}
}
document.all.fromday.value='<%=day%>'+ '/' +'<%=month%>' +'/'+'<%=year%>';
document.all.todate.value='<%=day%>'+ '/' +'<%=month%>' +'/'+'<%=year%>';
}
please replay me soon .I dont know how to display the default value and display the user entered value not the default value.