Go Back   Site Owners Forums - Webmaster Forums > Web Programming > Programming General > Javascript

Notices


Reply
 
Thread Tools Rate Thread Display Modes
Old 07-24-2013, 10:43 PM   #1
artijain1900
Registered User
 
Join Date: Jul 2013
Posts: 122
JavaScript setTimeout

Hello guys,

Can anyone tell me here that how can i use setTimeout() function in JavaScript in my project???
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
artijain1900 is offline   Reply With Quote

Old 09-26-2013, 12:05 PM   #2
jordan_rap13
Registered User
 
Join Date: Sep 2013
Location: Kalamata, Greece
Posts: 53
look at this example:

var dayarray=new Array("Sunday","Monday","Thusday","Wednesday","Thu rsday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May"," June","July","August","September","October","Novem ber","December")

function getthedate(){
var currentTime = new Date();

var day=currentTime.getDay();
var day_month = currentTime.getDate();
if (day_month<10){
day_month="0"+day_month;
}
var month = currentTime.getMonth();
var year = currentTime.getFullYear();

var hours=currentTime.getHours();
var minutes=currentTime.getMinutes();
var seconds=currentTime.getSeconds();

var last="am";
if (hours>=12){last="pm";}
if (hours>12){hours=hours-12;}
if (hours==0){hours=12;}

if (minutes<=9){minutes="0"+minutes;}
if (seconds<=9){seconds="0"+seconds;}

var ddate=dayarray[day]+"&nbsp;"+day_month+"&nbsp;"+montharray[month]+"&nbsp;"+year+",&nbsp;"+hours+":"+minutes+":"+sec onds+"&nbsp;"+last;

$(".date_time").html(ddate);

setTimeout("getthedate()",1000);
}

So the final line, will run the getthedate function every 1000ms (1 sec)
jordan_rap13 is offline   Reply With Quote
Old 03-11-2014, 12:33 AM   #3
alligatortek001
Registered User
 
Join Date: Nov 2013
Posts: 92
For example:

var heartbeat = function (data) {
if (!heartbeatInterval) {
// no heartbeat
return;
}

var obj = Package.encode(Package.TYPE_HEARTBEAT);
if (heartbeatTimeoutId) {
clearTimeout(heartbeatTimeoutId);
heartbeatTimeoutId = null;
}

if (heartbeatId) {
// already in a heartbeat interval
return;
}

heartbeatId = setTimeout(function () {
heartbeatId = null;
send(obj);

nextHeartbeatTimeout = Date.now() + heartbeatTimeout;
heartbeatTimeoutId = setTimeout(heartbeatTimeoutCb, heartbeatTimeout);
}, heartbeatInterval);
};

var heartbeatTimeoutCb = function () {
var gap = nextHeartbeatTimeout - Date.now();
if (gap > gapThreshold) {
heartbeatTimeoutId = setTimeout(heartbeatTimeoutCb, gap);
} else {
console.error('server heartbeat timeout');
pomelo.emit('heartbeat timeout');
pomelo.disconnect();
}
};
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
alligatortek001 is offline   Reply With Quote
Old 04-09-2014, 11:00 PM   #4
simar
Registered User
 
Join Date: Mar 2014
Posts: 71
set Timeout

Thanks for coding of javascript set timeout
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
simar is offline   Reply With Quote
Old 12-04-2014, 04:03 AM   #5
artijain1900
Registered User
 
Join Date: Jul 2013
Posts: 122
Thanks all of you guys for solving my query.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
artijain1900 is offline   Reply With Quote
Old 12-14-2014, 10:48 AM   #6
vkachuliak
Registered User
 
Join Date: Dec 2014
Posts: 7
For any action that has to be done after some time
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
vkachuliak is offline   Reply With Quote
Old 12-28-2014, 01:22 PM   #7
niel
Registered User
 
Join Date: Dec 2014
Location: Belgium
Posts: 131
thanks for explaining
__________________
Need some help on how to make your pc faster?
Got some trouble with a slow pc?
We can help you with making your pc faster.

Visit
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
niel is offline   Reply With Quote
Old 01-16-2015, 11:59 AM   #8
Rajesh S
Registered User
 
Join Date: Dec 2014
Posts: 25
thank you..
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
*|*
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Rajesh S is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Implement Interfaces in JavaScript JavaScriptBank Javascript 1 03-30-2014 11:48 PM
Javascript Countdown Timer redirecting Affiliate Links JavaScriptBank Javascript 0 05-20-2013 10:29 PM
40 Super Nice JavaScript Extensions and Plugins JavaScriptBank Javascript 0 04-28-2013 11:14 PM
9 Funniest JavaScript effects JavaScriptBank Javascript 0 04-18-2013 02:13 AM
65 Free JavaScript Photo Gallery Solutions JavaScriptBank Javascript 0 04-15-2013 06:38 PM


All times are GMT -7. The time now is 08:26 PM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.