Categories:

Home / Free JavaScripts / Messages / Here

Cut & Paste Animated Information Bar

Credit: JavaScript Kit

Description: This script mimics the interface of the IE ActiveX information bar that slides into view from the top of the browser in displaying information to your visitors in a eye catching way! The bar slides in view and remains static on the screen even when the user scrolls the page. Frequency control lets you limit the display of it to once per session if desired.

Example: Look at  the top of the page! Reload page if you didn't catch the "animated" effect.

Directions: Simply copy the below into the HEAD section of your page:

The script uses an image for the "close" button, which you should download below:

As you will see at the bottom of the script, the code to call the information bar is as follows:

<script type="text/javascript">
<!--Invocation code-->

var infobar=new informationbar()
infobar.setContent('Welcome to JavaScript Kit! It appears you are not registered yet on our site. Why wait? <a href="#">Register here</a>')
//infobar.setfrequency('session') //Uncomment this line to set information bar to only display once per browser session!
infobar.initialize()

</script>

The two important functions to take note are:

  • setContent(html_to_show): Enter the HTML you wish to be shown inside the Information Bar. Be sure to backslash (\) JavaScript reserved keywords to avoid errors (ie: 'He\'s my boy!').

  • setfrequency(keyword): Call this function to set the display frequency of the bar. The two valid values are "session" or "always". In the former, the bar is only shown once per browser session to the visitor.


JavaScript Tools:
Site Info


CopyRight (c) 2018 JavaScript Kit. NO PART may be reproduced without author's permission. Contact Info