iLTC Home
Bookmark iLTC!

Categories

Perl
  • Perl Tutorials Beginners

  • Javascript
  • Javascript Tutorials
  • Javascript Tutorials Beginners

  • HTML
  • HTML Tutorials

  • Command Line
  • Command Line Tutorials

  • How Tos
  • Other Tips and Tricks



  • for($i;$i < 1000;$i++) { }
    1721520

    iLoveTheCode.com

    Javascript and CSS - Easy Pop-Up Help Balloons

    I needed some pop-up help balloons for a site I am working on. There are plenty of available options and javascript classes to do this for you, but I can never resist doing things myself.

    Copy and paste into an html document and play with the variables to see what it does.

    By default the pop-up boxes will come up inline, but if you specify the "top" and "left" properties, and set display to "block" in the first div tag, you can make the messages come up on the screen anywhere you like.

    Colors and sizes, etc. are also controlled in the div tag, with the <a> tag being for the X that closes pop-up.

    As explained below, you can use this over and over again on the same page, provided you change the ID names where instructed.

    NOTE: If you copy and paste this code, watch out for spaces and line returns put in by the browser.


    <html>
    <body>
    Here is the Balloon Template:
    <script type="text/javascript">
    function displayBalloon(id,toggle) {
    if (toggle == "on") {
    document.getElementById(id).style.display = "inline";}
    else {
    document.getElementById(id).style.display = "none";}
    }
    </script>

    <!--
    xxxxxNAMExxxxx : Change in three places to any value that doesn't already exist on page.
    xxxxxBOXTEXTxxxxx : Text for balloon box.
    xxxxxCLICKTEXTxxxxx : Text to be clicked.
    First <div> controls box - to move box to different locations on page, set display to block, and top and left properties
    in pixels. Set any other properties. If font-family not specified, will likely inherit.
    First <a> controls x to close box.
    Second <div> is to prevent inheritance.
    Second <a> is for page link to bring up balloon.
    -->

    <div id=xxxxxNAMExxxxx style='top:;left:;width:250px;height:125px;color:white;background-color:#ba0118;border-style:solid;border-width:3px;border-color:#000000;padding:15px;text-align:left;position:absolute;display:none;text-decoration:none;'>


    <a style='font-family:sans-serif;font-size:24px;font-weight:normal;text-align:left;display:block;line-height:8px;margin:-5px 0px 8px -8px;padding:0px 0px 0px 0px;' onMouseOver="this.style.fontWeight='bold';" onMouseOut="this.style.fontWeight='normal';" onClick="displayBalloon('xxxxxNAMExxxxx','off');return false">×</a>

    <div style="display:inline">xxxxxBOXTEXTxxxxx</div></div><a href=# class="darklink" style="text-decoration:none;" onClick="displayBalloon('xxxxxNAMExxxxx','on');return false;"><b>xxxxxCLICKTEXTxxxxx</a>:</b>
    </body>
    </html>





    Previous Article: Javascript Ajax Call
    Next Article: onClick Javascript






    Search iLTC w/ Google




    Recent Articles

  • HTML Font Code
  • Javascript and CSS - Easy Pop Up Help Balloons
  • Use OnMouseOver in Javascript
  • Use onMouseOut in Javascript
  • Use innerHTML to Change Text on a Page
  • Renaming a File with Perl's RENAME Function
  • PRINT to Browser with document.write Command in Javascript
  • Passing an Argument or Variable to a Javascript
  • Opening an Alert Box in Javascript
  • Opening a REMOTE WINDOW in Javascript
  • OPEN and WRITE a Data File in Perl
  • OPEN and READ a Data File in Perl
  • Mimic Typing from a Textfield in a Textarea with Javascript
  • Javascript Reset Form








  • Perl Programming - Javascript Programming - HTML Code - Mac Unix Command Line - Maybe Some PHP - Free Scripts - ILoveTheCode
    All Content © 2006-2009 iLoveTheCode.com


    Contact Chris | About this Site


    1721248
    Counter by iLoveTheCode.com


    Last Modified: Monday, 05-Oct-2009 00:08:55 EDT



    Hosted as well :)
    Home-brewed logo - 1997