Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How I can automatically close the alert box as soon as it appears

    Hi friends....
    I have an alert message just like


    Code:
    alert("Hiii");


    I want to close it automatically as soon as it appears.
    It means I don't want to show this alert message to client.
    Can anyone tell how i can do it???
    Please help me......
    Thanks in advance....

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,452
    Thanks
    23
    Thanked 631 Times in 630 Posts
    I don't want to show this alert message to client.
    Why not just comment this line out? Then you can add it back when needed.

  • #3
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by sunfighter View Post
    Why not just comment this line out? Then you can add it back when needed.
    Actually I use alert to just flash my task bar when it is not active. So, i can't remove it but i don't want to show it to user.
    Is there any way that it closes automatically....

  • #4
    Regular Coder
    Join Date
    Aug 2010
    Posts
    974
    Thanks
    19
    Thanked 212 Times in 210 Posts
    Quote Originally Posted by ankit.pandey3 View Post
    Actually I use alert to just flash my task bar when it is not active. So, i can't remove it but i don't want to show it to user.
    Is there any way that it closes automatically....
    Try replacing alert with
    window.blur();window.focus();
    Maybe that will "flash your task bar" .
    Last edited by DaveyErwin; 09-18-2011 at 07:45 AM.

  • #5
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DaveyErwin View Post
    Try replacing alert with
    window.blur();window.focus();
    Maybe that will "flash your task bar" .
    Thanks for reply friend but window.blur();window.focus(); not works. Any other idea to blink taskbar??

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,561
    Thanks
    80
    Thanked 4,496 Times in 4,460 Posts
    Blink something else, instead.

    For example, put a <div> at the bottom of your page and change its background color, briefly, as a "blink".
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #7
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    Blink something else, instead.

    For example, put a <div> at the bottom of your page and change its background color, briefly, as a "blink".
    I think it works only when window is active but not when it is minimized.

  • #8
    Regular Coder
    Join Date
    Apr 2005
    Location
    Texas
    Posts
    448
    Thanks
    24
    Thanked 63 Times in 63 Posts
    I don't think that alert has any such methods for closing it through script, but here's a possible out-of-the-box solution for your out-of-the-box question...

    If you enable your browser to warn of script errors (and I'm only sure of this working in IE) then you could put a harmless error in your script, that doesn't effect performance, at the time the alert is supposed to fire. Almost nobody except developers have "show script errors" enabled, so they won't see it. So I guess if there are no other errors on your page that could possibly give you a false positive, that might actually work.

    What I do when I want to add special features to my site that only apply to me is use cookies to identify myself and only enable those features (usually for debugging) when my cookie is active.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •