/    Sign up×
Community /Pin to ProfileBookmark

Javascript messages

How can I give the user an “Operation completed successfully” message with a proper icon using javascript ?
I know I have alert() for errors and confirm() for confirmations, but is there a function for success ?

Thanks,
Alon

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@balloonbuffoonFeb 20.2005 — Here's a link for a tutorial on different variations of alerts using VBScript.

[URL=http://www.javascriptkit.com/javatutors/vbalert.shtml]Click Here[/URL]

With VBScript you can change the picture and the kind of buttons that are in the alert.

-Steve
Copy linkTweet thisAlerts:
@alonauthorFeb 20.2005 — 
  • 1. Thanks.

  • 2. From your answer I understand that there is no way to do it using Javascript. Is that correct ?
  • Copy linkTweet thisAlerts:
    @FangFeb 20.2005 — 
  • 1. the 'solution' only works in IE, other browsers will see no alert window.

  • 2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    <title>Simple popup</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <script type="text/javascript">
    <!--
    function showAlert(event) {
    // Scroll offset:
    var Ypos, Xpos;
    if (window.pageYOffset)
    Ypos=window.pageYOffset;
    else if (document.documentElement && document.documentElement.scrollTop)
    Ypos=document.documentElement.scrollTop;
    else if (document.body)
    Ypos=document.body.scrollTop;

    if (window.pageXOffset)
    Xpos=window.pageXOffset;
    else if (document.documentElement && document.documentElement.scrollLeft)
    Xpos=document.documentElement.scrollLeft;
    else if (document.body)
    Xpos=document.body.scrollLeft;

    // display popup
    var oPop=document.getElementById('popup').style;
    oPop.top=event.clientY+Ypos+'px';
    oPop.left=event.clientX+Xpos+'px';
    oPop.display='block';
    }
    //-->
    </script>

    <style type="text/css">
    <!--
    #popup {
    z-index:0;
    position:absolute;
    display:none;
    width:10em;
    height:10em;
    border:3px solid #06f;
    background:#fff;
    color:#000;
    }
    #titlebar {
    height:1.3em;
    background:#06f;
    color:#fff;
    font-weight:bold;
    font-size:small;
    padding-bottom:1px;
    }
    #x {
    float:right;
    cursor: pointer;
    width:1em;
    height:1em;
    border:1px solid #fff;
    background:red;
    color:#fff;
    text-align:center;
    }
    #popup p {
    padding:3px;
    }
    -->
    </style>

    </head>
    <body>
    <div id="popup">
    <div id="titlebar">
    <div id="x" onclick="document.getElementById('popup').style.display='none';">X</div>
    Simple popup
    </div>
    <p>image and text here</p>
    </div>
    <button type="button" onclick="showAlert(event);">showAlert</button>
    </body>
    </html>

    or

    http://www.klproductions.com/kltooltips.html
  • Copy linkTweet thisAlerts:
    @alonauthorFeb 20.2005 — 10x. I'll try it.
    ×

    Success!

    Help @alon spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.19,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...