Results 1 to 4 of 4

Thread: Needed: show message once at the top script

  1. #1
    Join Date
    Oct 2012
    Posts
    180
    Thanks
    22
    Thanked 1 Time in 1 Post

    Default Needed: show message once at the top script

    I need something similar to what http://monster.com has. If you visit it you will notice how the whole page is pushed down by a yellow bar with a text at the top of the page. It's cookie based and once it's closed it doesn't show up again.

    I found drop down boxes, sticky notes, etc. scripts on DD, but nothing similar to this one.

    Can you guys point me in the right direction where I can find a script like that? Or maybe you have one in your own library?

    Thank you!

  2. #2
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    Code:
    <script>
    var alertmessage="This is an alert."
    
    function prompt_once_per_session()
    {
    if( !/(^|\s|;)seenAlert=yes(;|\s|$)/.test(document.cookie))
    {if( !confirm(alertmessage+'\n\nClick on OK if you don`t want this message to show again.\n\nClick on CANCEL if you want this message to show each time you load this page.') )
    {}
    else {document.cookie="seenAlert=yes";}
    }
    }
    
    if ( typeof window.addEventListener != "undefined" )
        window.addEventListener( "load", prompt_once_per_session, false );
    else if ( typeof window.attachEvent != "undefined" )
        window.attachEvent( "onload", prompt_once_per_session);
    else {
        if ( window.onload != null ) {
            var oldOnload = window.onload;
            window.onload = function ( e ) {
                oldOnload( e );
                prompt_once_per_session();
            };
        }
        else
            window.onload = prompt_once_per_session;
    }
    </script>

  3. #3
    Join Date
    Oct 2012
    Posts
    180
    Thanks
    22
    Thanked 1 Time in 1 Post

    Default

    molendijk, this is just another popup. I need something that will work like here: http://monster.com

    Notice the yellow bar that pushes the site down...

  4. #4
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    I don't see a yellow bar. But couldn't you just create one with a close button in it? It could be a div with id="show_once". Then using onclick="document.getElementById('show_once').style.display='none'" on the button will hide the div. No cookies needed, I think.

Similar Threads

  1. Help needed with rss ajax ticker (advanced) - see error message posted
    By Steve_webster in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 03-19-2012, 08:54 PM
  2. Help needed with DHTML Tip Message
    By georgee in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 09-04-2010, 09:51 PM
  3. Auto size for: Fixed Tooltip script and Show Hint script needed
    By Null in forum Dynamic Drive scripts help
    Replies: 40
    Last Post: 04-26-2006, 01:18 PM
  4. Fading message scroller FF1+ IE5+ Opr7+ - HELP NEEDED
    By Xposure in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 03-01-2006, 03:37 PM

Bookmarks

Posting Permissions

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