how to display the time in a text box


Y

keyboard_arrow_up
0
keyboard_arrow_down


First Post Yakko
Posts: 2 - Registered: 2006-12-20 16:24:09

hi all..
my query goes lik dis..
i ve got a text box in which current time should be displayed after a particular interval of time say for every 10 minutes it should display the current time in that text box..
thanx



5 Replies


X

keyboard_arrow_up
0
keyboard_arrow_down


Reply #1 X-Bumble
Posts: 8 - Registered: 2009-02-16 18:31:38

I would suggest you use either Javascript or PHP to call the time from the server.

Re-post this in one of those forums (if they have them here) and you will get more joy.




Y

keyboard_arrow_up
0
keyboard_arrow_down


Reply #2 Yakko
Posts: 2 - Registered: 2006-12-20 16:24:09

actually im supposed to use javascript/jsp..
can u pls guide me here!!!




R

keyboard_arrow_up
0
keyboard_arrow_down


Reply #3 rangana
Posts: 935 - Registered: 2008-02-26 23:14:24

<script type="text/javascript">
/**
Script Title: Update Textbox with time with an interval
Script Author: Raymond Angana as first seen on devppl.com/forum [username = rangana]
Date Created: 3/4/09
This notice must stay intact for legal use
*/
var ray = {
el:'', pause:0,

updateText:function (el,pause) {
this.el=this.el==''?el:this.el;
this.pause=this.pause==0?pause:this.pause;
this.getID(this.el).value = this.timeNow();
setTimeout(function () {
ray.updateText();
},this.pause*(6000));
},

getID:function (el) {
return document.getElementById(el);
},

timeNow:function () {
var date = new Date();
var hour = date.getHours();
var min = date.getMinutes();
var sec = date.getSeconds();
return hour+':'+min+' '+sec;
}
}
</script>
<input type="textbox" id="mytextbox" disabled="disabled">
<script type="text/javascript">
/**
Script Title: Update Textbox with time with an interval
Script Author: Raymond Angana as first seen on devppl.com/forum [username = rangana]
Date Created: 3/4/09
This notice must stay intact for legal use
*/
ray.updateText('mytextbox',10); // Pass the ID of the textbox and the time update interval (computed per minute. 10 means 10 minutes
</script>




Y

keyboard_arrow_up
0
keyboard_arrow_down


Reply #4 Yakko
Posts: 2 - Registered: 2006-12-20 16:24:09

thanks alot rangana!!!!
it worked..
thanku once agin...




Y

keyboard_arrow_up
0
keyboard_arrow_down


Reply #5 Yakko
Posts: 2 - Registered: 2006-12-20 16:24:09

hi guys..
i ve got data from database to be displayed in one jsp and i should make those datas to be displayed in the next jsp...
how to send those one..
its been urgent... can anyone pls telll me the way??
thanku






JOIN DEVPPL

It looks like you are new here. If you want to get involved, click on Join below!




MENU
Advertising