Hello guys,
I’ve a question. I am trying to populate the javascript and want to return the value to the
jsp page.. The function is like this.
function difference(startTime, endTime){
var starttime = document.getElementById(startTime).value;
var endtime = document.getElementById(endTime).value;
var stime = starttime.getHours();
var etime = endtime.getHours()
document.getElementById(startTime).value = stime
document.getElementById(endTime).value = etime
if(etime>=stime){
return (etime-stime);
}
else if(etime<=stime){
alert("enter valid time");
}
}
and this should return the control to the jsp page and should populate the difference. And the html inside jsp is
<tr>
<td > Number of Hours
<input type="text" id="hour" name="hour" readonly size="4" onchange="difference('gsmastarttime', 'gsmaendtime')">
</td>
</tr>
This is a readonly text box. So i've the start time and endtime from another function and getting the values to difference function and also those values are present in the html embedded inside jsp. Its not printing the difference. So wat should i do inorder it prints the difference in the readonly text box?? Please help guys.
Thank in advance.