Hi.
I created two Fields which showing time
One field is From which is combo so that use can select
the time and another field To is Clock as in PHP wont refresh clock so i used javascript for that. another field is to get the time difference beiween these two fields.
anybody knows how to calculate the time difference which will show automatically in third field,i mean to say i dont have to click in any of from and to fields.
<How i can get the time diff. in 3rd field without clicking on any of the fields is it possible,if not then what to doPHP Code:function fillDD($min, $max, $selected)
{
for($i=$min; $i<24; $i++)
{
for($j=$max; $j<60; $j+=5)
{
if($i == $selected && $j == $selected)
{
if ($i < 10) {
print("<option SELECTED value='$i:$j'>0$i:$j</option>\n");
} else {
print("<option SELECTED value='$i:$j'>$i:$j</option>\n");
}
}
else
{
if ($i < 10) {
print("<option value='$i:$j'>0$i:$j</option>\n");
} else {
print("<option value='$i:$j'>$i:$j</option>\n");
}
}
}//for($j)
} //for($i)
}
From:
<select name="From" size="1" onFocus="calculateIst()">
<option selected value="<?=date('H:i')?>"><? echo (date('H:i')); ?></option>
<? fillDD(8, 0, -1); ?>
</select>
To:
<input type="text" size="2" class="button" name="bis" readonly>
<input size="1" class="button" type="text" value="0" name="Time Diff" readonly></td>
<SCRIPT language="JavaScript">
function show(){
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
document.tstest.bis.value=hours+":"+minutes
setTimeout("show()",1000)
}
show()
</script>
thanks in advance
zuzupus



Reply With Quote
Bookmarks