Solved

VBscript question on displaying a timed message

Posted on 2004-09-14
16
387 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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
 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Add server behaviors to Dreamweaver CC 2015 2 185
classic asp checkbox uncheck and check 2 69
Use a variable for Class Name in Classic ASP 4 61
Help with query 3 31
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…

828 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