Click here to Skip to main content
6,595,854 members and growing! (17,472 online)
Email Password   helpLost your password?
Web Development » Client side scripting » General     Intermediate

JSBalloon: non modal feedback mechanism for DHTML applications

By Arkady Lesniara

A flexible, encapsulated way to implement a passive feedback mechanism.
JavascriptWin2K, WinXP, Win2003, TabletPC, Visual Studio, IE 6.0, Dev
Posted:14 Jul 2005
Updated:7 Sep 2005
Views:74,746
Bookmarked:55 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
17 votes for this article.
Popularity: 5.78 Rating: 4.70 out of 5

1

2
1 vote, 5.9%
3
3 votes, 17.6%
4
13 votes, 76.5%
5

Sample Image - jsballoon.jpg

Introduction

While working on a large intranet application I found that between validation errors, save confirmation messages, and other user feedback events, there were an awful lot of modal dialog boxes I had to pop and respond to. This DHTML object provides a balloon pop-up not unlike the Microsoft's tray balloon. While I agree that pop-ups are mostly a nuisance in the web environment, this form of rich tool tip may be very handy in streamlining user experience.

One of the features, in a form of an autoHide property, included in JSBalloon for example is the ability to hide the tool tip as soon as the user's mouse moves over it, thus swiftly allowing them to continue on with their work. Another advantage is the ability to place HTML code and form elements within a balloon, thus providing users with optional functionality that may either be easily dismissed or will hide on its own. The main purpose of this exercise, however, is to try and minimize the number of clicks and mouse moves the user needs to make.

Background

JSBalloon is not meant as a replacement for some other excellent DHTML (JavaScript) pop-up libraries e.g. Jwin Popup Library or overLIB. Rather it is meant as a very simple enhancement of tool tip functionality within the DHTML environment. Note that the code was tested and will run in Microsoft Internet Explorer 6 only. Also, it was created for a fixed screen.

Using the code

The only thing you will need to do after copying the JSBalloon.js file to your web server is to update the JSBalloonPath variable with the full path where it is located. This is needed for locating the images and icons.

When instantiating new objects make sure that your JSBalloon variables are globally scoped and instantiated only once per object:

<script language="JavaScript">

var b4=new JSBalloon({ width:150, 
                       autoAway:false, 
                       autoHide:false,
                       showCloseBox:true});

Once the object is created you may use the Show method to display a balloon and Hide method to hide it.

The following example demonstrates how to show a balloon. Note that B3 is the ID of a button on a page. The anchor is optional and you may use top and left named arguments to place the balloon anywhere on a page instead.

b4.Show({title:'JavaScript Balloon Example',
    message:'This is an example of a JSBalloon object. '+
        'It\'s primary application is to provide ' +
        'a modeless feedback to DHTML applications.',
    anchor:B3});

You may also mix and match the arguments and properties:

var bl=new JSBalloon({ width:300});

function testBalloon()
{        
    bl.autoHide=false;
    bl.transShow=true;
    bl.autoAway=false;
    bl.showCloseBox=true;
    bl.transShowFilter="progid:DXImageTransform.Microsoft"+
        ".Stretch(stretchstyle=SPIN)";
    bl.transHideFilter="progid:DXImageTransform.Microsoft"+
        ".Slide(slidestyle=HIDE,Bands=1)";
    bl.Show({title:'JavaScript Balloon Example',
        message:'This is an example of a JSBalloon object. ' + 
                'It\'s primary application is to provide a '+
            'modeless feedback to DHTML applications.',
        anchor:B3, icon:'Info'});
}

and to hide:

b4.Hide();

Note that you don't have to call Hide if autoHide is true. Also, if autoAway is true the Hide method is called when a user moves the mouse over the balloon.

Please review the included source documentation for all the methods and properties.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Arkady Lesniara


Member
Arkady Lesniara is a Senior System Analyst/Developer based in Toronto, Canada, specializing in .Net solutions that focus on ASP .Net, VB .Net, T-SQL, AJAX, and all related technologies.
Occupation: Web Developer
Location: Canada Canada

Other popular Client side scripting articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 39 (Total in Forum: 39) (Refresh)FirstPrevNext
GeneralThanks for this post Pinmemberdeepak_rai0:18 25 Jan '08  
Questionhow I can show a balloon PinmemberTom_MJU23:20 11 Sep '07  
GeneralHow to pass .aspx page in this function Pinmemberer.miteshpatel17:48 11 Aug '07  
GeneralHow can i implement it in ASPX ? Pinmemberamitsm14322:14 2 Apr '07  
GeneralRe: How can i implement it in ASPX ? PinmemberArkady Lesniara16:14 3 Apr '07  
GeneralPrinting page with balloons Pinmemberdlbjr110:26 7 Mar '07  
GeneralUpdates to JSBalloon [modified] PinmemberNiraj Sharma6:50 8 Dec '06  
QuestionUnable to Immplement the JsBallon in my aspx file VS 2005 Pinmembersew new10:13 4 Aug '06  
GeneralDid anyone get it working in firefox? Pinmemberzquad18:09 15 May '06  
GeneralRe: Did anyone get it working in firefox? PinmemberSemXYZ12:42 19 May '06  
QuestionIs this JSBalloon licensed or Free for use? PinmemberWayne G. L9:16 12 May '06  
AnswerRe: Is this JSBalloon licensed or Free for use? PinmemberArkady Lesniara9:29 12 May '06  
GeneralFirefox 1.5.0.2 Pinmemberpoinciana5:25 20 Apr '06  
GeneralYou are delayed 1 year PinsussAnonymous9:42 9 Sep '05  
GeneralRe: You are delayed 1 year PinmemberSORUOPNEHPETS10:20 21 Sep '05  
GeneralFirefox version PinmemberAndy Krafft8:31 8 Sep '05  
GeneralObjectOverlap PinmemberDeKale12:43 5 Sep '05  
GeneralRe: ObjectOverlap PinmemberArkady Lesniara6:02 6 Sep '05  
GeneralBalloon positioning upon scrolling PinmemberAndy Krafft10:54 7 Aug '05  
GeneralRe: Balloon positioning upon scrolling PinmemberArkady Lesniara4:52 8 Aug '05  
GeneralRe: Balloon positioning upon scrolling Pinmemberalbans22:40 7 Apr '08  
General.Show Delay PinsussAlex Haines15:26 28 Jul '05  
GeneralRe: .Show Delay PinmemberArkady Lesniara5:46 29 Jul '05  
GeneralRe: .Show Delay PinmemberAlex Haines8:15 29 Jul '05  
Generalbad look when used in aspx page PinmemberADuhoux5:25 28 Jul '05  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 7 Sep 2005
Editor: Sean Ewington
Copyright 2005 by Arkady Lesniara
Everything else Copyright © CodeProject, 1999-2009
Web11 | Advertise on the Code Project