Results 1 to 1 of 1
Thread: Alert box showing time left
- 11-19-2007, 08:56 AM #1
Member
- Join Date
- Nov 2007
- Posts
- 2
- Rep Power
- 0
Alert box showing time left
Hi all,
Im new to this forumn. my problem is related to javascript.
i just needto display an alert(confirm box) showing time left in session timeout. and OK option for user to continue with the session and if not alert box automatically gone
code is like
//========= time out check STARTS====
function Minutes(data) {
for (var i = 0; i < data.length; i++)
if (data.substring(i, i + 1) == ":")
break;
return (data.substring(0, i));
}
function Seconds(data) {
for (var i = 0; i < data.length; i++)
if (data.substring(i, i + 1) == ":")
break;
return (data.substring(i + 1, data.length));
}
function Display(min, sec) {
var disp;
if (min <= 9) disp = " 0";
else disp = " ";
disp += min + ":";
if (sec <= 9) disp += "0" + sec;
else disp += sec;
return (disp);
}
function Down() {
sec--;
if (sec == -1) { sec = 59; min--; }
window.status = "Session will time out in: " + Display(min, sec);
if (min == 0 && sec <= 10) {
/** what to do here?? to display an alert box showing 10,9,8,7 ..
when ten seconda left in session time out **/
alert("Your Session is going to expire in "+ +" Click OK to Continue");
}
else down = setTimeout("Down()", 1000);
}
window.onload = function timeIt() {
min = 1 * Minutes('00:15');
sec = 0 + Seconds('00:15');
Down();
}
//========= timeout ENDS====
Similar Threads
-
Javascript Alert
By mutuah in forum New To JavaReplies: 4Last Post: 03-25-2010, 05:28 PM -
menu in top left always
By sschwinghammer in forum New To JavaReplies: 2Last Post: 02-06-2008, 02:39 PM -
Using Alert in MIDlet
By Java Tip in forum Java TipReplies: 0Last Post: 11-22-2007, 10:22 AM -
How to make the menu bar objects appears from right to left
By JavaBean in forum AWT / SwingReplies: 3Last Post: 07-19-2007, 11:12 AM -
Why isn't this showing?
By JToolTip in forum Java AppletsReplies: 2Last Post: 07-07-2007, 11:54 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks