Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-19-2007, 09:56 AM
Member
 
Join Date: Nov 2007
Posts: 2
hasansheikh18 is on a distinguished road
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====
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
menu in top left always sschwinghammer New To Java 2 02-06-2008 03:39 PM
Using Alert in MIDlet Java Tip Java Tips 0 11-22-2007 11:22 AM
How to make the menu bar objects appears from right to left JavaBean AWT / Swing 3 07-19-2007 12:12 PM
Javascript Alert mutuah New To Java 0 07-09-2007 12:11 AM
Why isn't this showing? JToolTip Java Applets 2 07-08-2007 12:54 AM


All times are GMT +3. The time now is 07:39 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org