Solved

VBscript question on displaying a timed message

Posted on 2004-09-14
16
357 Views
Last Modified: 2012-08-13
How do I create a message box or a display that will close by itself in a certain number of seconds

Basically I want a box to pop up when a user logs on and then automatically dissappear after a specified amount of time.
0
Comment
Question by:rfedeleo
  • 7
  • 4
  • 2
  • +1
16 Comments
 
LVL 4

Expert Comment

by:mistyrae
ID: 12058105
In the body element of your pop-up window, call setTimeout in the onLoad attribute... Like this:

<body onLoad="setTimeout('window.close()', 5000)">

That example will close the window in 5 seconds (setTimeout uses milliseconds as its time argument)

- misty
0
 
LVL 19

Accepted Solution

by:
peh803 earned 125 total points
ID: 12058153
here's a 2 page example (just copy and paste the code into the two pages default.html and pop2.html as specified).

regards,
peh803

<!-- BEGIN Page 1 -- default.html-->
<script type="text/javascript">
function MyOnload(){
  window.open('pop2.html');
}  
</script>
<BODY onload="MyOnload();">
  This is default.html.  When this page loads, pop2.html will popup and then close after 5 seconds.
</BODY>
<!-- END Page 1 -- default.html-->


<!-- BEGIN Page 2 -- pop2.html -->
<script type="text/javascript">
var timer = 5;
function TimedCloser()
{
  if(timer > 0)
  {
    document.getElementById('seconds').innerHTML = timer;
    timer -= 1;
    setTimeout("TimedCloser()",1000);
  }
  else
  {
    window.close(this);
  }
}

</script>
<BODY onload="TimedCloser(5);">
  Here's pop2.html.  This window will close in <span id=seconds>5</span> seconds.
</BODY>
<!-- CLOSE Page 2 -- pop2.html -->
0
 
LVL 19

Expert Comment

by:peh803
ID: 12170350
@rfedeleo -- considering I gave you a fully functional example, why did you give me a grade of a "C"?  Obviously, I'll steer clear of helping out on your questions in the future, as will other experts who see this grade (particularly when you've provided no explanation as to why the low grade).  

If you still have problems, you should post questions seeking clarification, etc.  But to give a "C" with no explanation is a slap in the face to those who donate their time to help you out.

peh803
0
 

Author Comment

by:rfedeleo
ID: 12176274
I seriously doubt anyone else will "steer clear" of my questions. I pay my 9.95 a month just like everyone else who pays and I give my points away to people who answer the questions so they get the  free benefits of this site. So I'll give any kind of grade I please. And if you want a reason it's because I did not use your solution for what I was working on and just wanted to close the Question out. The only reason I picked yours was because it had a little more effort than the other persons. Therefore I did not even test your solution! But bottom line is you got the points, and I chose "average" as the response (how am I supposed to know that they give you a letter grade, what is this high school) and give me a break with your "slap in the face" comment do you think you're the only person writing these things...what about people on the microsoft self help forums that do this stuff and don't get anything back, no grades, no free benefits, no points. So you stick with your C grade and get an A+ for whining.
0
 
LVL 19

Expert Comment

by:peh803
ID: 12179724
My point here was not to be a whiner -- just that when someone gives a C, it's typically because

  a.) the solution provided did not work
  b.) no solution was provided
  c.) they worked long and hard to come to a solution, and no one could come up with anything

But at least you should post some kind of response as to why the lowest grade is being given -- something which you did not do until just now, when it is too late.  
0
 
LVL 19

Expert Comment

by:peh803
ID: 12222688
The only history we share is shown here in this question.  I never meant to make it a big deal...I just thought I deserved some kind of explanation as to why a C was given.

peh803
0
 

Author Comment

by:rfedeleo
ID: 12238707
Fritz
I wasn't trying to be ungrateful. I was just a little shocked that someone would complain about the grade they got. If that's the case why even put the grading system in. Just give them the points. Another thing is I did not know about the grades, all I saw were the choices of Excellent, some other choice, and average so I chose average (and explained why above). No where did it indicate what the equivalent letter grades were.

 I did nothing wrong by giving my points and an "average" grade. That said had I known letter grades were given out I probably would have not given a C.

Now, to be told that I probably would not have any other experts answer any future questions or that a C grade was a slap in the face, was a shock to me and that's what brought on my response.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 12238890
@rfedeleo:

Thanks for writing. For details on grading, please see:

http://www.experts-exchange.com/Web/Web_Languages/ASP/help.jsp#hi73

If you would like me to change the grade, please let me know.

Fritz the Blank
Page Editor
ASP Topic Area
0
 

Author Comment

by:rfedeleo
ID: 12245140
What the heck... go ahead and change it to a B, and thanks for the link.
0
 
LVL 19

Expert Comment

by:peh803
ID: 12245397
rfedeleo --
Thanks, I do appreciate it.

Also, if there's any way you could modify / remove the feedback that you left on my profile, I would appreciate it.  

Thanks in advance,
peh803
0
 
LVL 19

Expert Comment

by:peh803
ID: 12245400
Also, ty FtB, for your help with this situation.

peh803
0
 

Author Comment

by:rfedeleo
ID: 12249714
Fritz,
   Could you remove the feedback I left, or point me to how I can do it.

Thanks
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 12249918
You should be able to modify it by going here:

http://www.experts-exchange.com/viewMemberFeedback.jsp?mid=1322706

If not, please let me know and I will have a moderator remove the feedback.

Thank you!

FtB
0
 
LVL 19

Expert Comment

by:peh803
ID: 12298865
@rfedeleo:

Any luck on removing that feedback?  As yet, it doesn't appear so, as it's still there.

Please let me / FtB know if you need any more guidance / help in removing it.

Thanks,
peh803
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now