JavaScript
  Home arrow JavaScript arrow Creating Pop-up Notes with CSS and JavaScr...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Creating Pop-up Notes with CSS and JavaScript Part II
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 22
    2005-01-24

    Table of Contents:
  • Creating Pop-up Notes with CSS and JavaScript Part II
  • The HTML markup
  • The complete code
  • Summary

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Creating Pop-up Notes with CSS and JavaScript Part II


    (Page 1 of 4 )

    A pop-up note contains information and can be made to appear when a visitor to your website moves the mouse over the appropriate area. In our second of two articles about pop-up notes, Alejandro Gervasio explains how to create multiple pop-up notes on a Web page using CSS and JavaScript.

     

    Creating multiple pop-up notes

    Once we’ve taken an in-depth look at our previous example, it’s easy to generate multiple pop-up notes with JavaScript. The basic idea rests on tying each link displaying a note to the corresponding <div> element that includes the pop-up note content. When we set up the relationship between the elements, all we need to do is write the JavaScript code for programmatically manipulating the visual display of the pop-up notes. So, let’s begin defining our CSS code:

    <style type="text/css">

    p {
                font: normal 11px "Verdana", Arial, Helvetica, sans-serif;
                color: #000;
    }

    a.special:link,a.special:visited {
                font: bold 11px "Verdana", Arial, Helvetica, sans-serif;
                color: #00f;
                text-decoration: underline;
    }

    a.special:hover {
                color: #f00;
    }

    .note {
                position: absolute;
                top: 0px;
                left: 0px;
                background: #ffc;
                padding: 10px;
                border: 1px solid #000;
                z-index: 1;
                visibility: hidden;
                font: bold 11px "Verdana", Arial, Helvetica, sans-serif;
                color: #000;
    }

    </style>

    The CSS declarations are almost identical to those corresponding to the single pop-up note. We’ve redefined the <p> tag, for this example, and then we’ve declared the "special" class to get the links a little styled. Finally, we define a class named "note," which will apply the style to all of the pop-up notes present on the Web page. Since all the notes will be hidden from view, they’re absolutely positioned to X-Y coordinates: 0px 0px. Their visibility property is set to "hidden" initially, but, as we know, will be changed accordingly.

    More JavaScript Articles
    More By Alejandro Gervasio


       ·  Here's the second part of the article. We're dealing with creating multiple...
       · I'm confused as to why you've used visibility:hidden; instead of...
       ·  That's right. Visibiliy simply hides the element without removing it from the...
       · The notes stay visible in Safari (1.2.4) when using onmousemove - changing to...
       ·  Yes,I've tried with Firefox, but it doesn't handle properly the event object when a...
       · Error: event is not definedSource File:...
       · Hi,I was unable to acces your provided URL.Alejandro Gervasio
       · As the code is it does not work with Firefox. It did, however, work properly with...
       · Hi Alejandro,Great article. From it, I figured out 2 things:1) simpler way...
       · Hi thereI have tried this with long pages. The pop-up notes work in the top part...
       · Hello,Thank for your comments on this article. With reference to your question,...
       · Hello,Thanks for the comments. Regarding your question, here's a modified...
       · Thank you very much AlejandroI used some bits of your code along with info from...
       · Hello again,Thank you for posting your message. I'm glad to hear that you found...
       · Even with this modified code, I still see the same problem. The pops aren't visible...
       · Thank you for your feedback. I changed the function I posted before, in order to...
     

    JAVASCRIPT ARTICLES

    - Detect Browser Compatibility with the Reques...
    - Using the EXT JS Date Picker Widget
    - Ajax Hack for Entering Information Without R...
    - EXT JS 2.1 Overview
    - Using the Style Object for Zebra Tables with...
    - Binary Searching
    - An Improved Approach to Building Zebra Tables
    - Assigning Background Colors Dynamically to Z...
    - Building Zebra Tables with CSS and JavaScript
    - JavaScript: Array Objects
    - A Closer Look at Smart Markers with Yahoo! M...
    - Using Polylines and Smart Markers with Yahoo...
    - Bulleted Menu of Links
    - Creating Click Loggers and Basic Markers wit...
    - Adding Pan Controls to Yahoo! Maps


    IBM developerWorks





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway