Click here to Skip to main content
12,450,766 members (48,097 online)
Click here to Skip to main content
Articles » Web Development » Ajax » General » Downloads

Stats

33.5K views
226 downloads
35 bookmarked
Posted

Context Sensitive Help using Client Callbacks - AJAX Style

, 25 Sep 2006
This article is all about providing Context Sensitive Help in a web page, asynchronously or AJAX style, using Client Callbacks in .NET 2.0.
ContextSensitiveHelpCode
ContextSensitiveHelp_src
ContextSensitiveHelp
App_Code
App_Themes
ControlsTheme
ContextSensitiveHelp.skin
CSS
Database
SampleDataBase.mdb
IMG
ContextSensitiveHelp.gif
Scripts
UserControls
Xml
Messages.dtd
 /* variables */
var objParentObject;
var objobjElement;
var blnDraggable = false;
var intOriginalXOffset;
var intOriginalYOffset;

/* SetHelpDraggable( objElement )
 * Allows the help box to be dragged across the
 * screen.
 */
function SetHelpDraggable( objElement ) { 
    /* get the container object */
 
    
    objParentObject = objElement.parentElement;
         
    while (objParentObject.id=="" && objParentObject != null)
        objParentObject = objParentObject.parentElement;        
    
    /* set the handle object */
    objobjElement = objElement;
    
       
    
    
	blnDraggable = true;	
	SetOpacity(objParentObject,50);
	
	intOriginalXOffset = window.event.offsetX;
	intOriginalYOffset = window.event.offsetY;	
}

/* SetHelpFixed()
 * Stops the help box from being draggable
 */
function SetHelpFixed() {
	SetOpacity(objParentObject,100);
	blnDraggable = false;	
}

/* SetHelpClosed()
 * Closes the help box and makes it invisible
 */
function SetHelpClosed(objElement) {
    /* get the container object */
    objParentObject = objElement.parentElement;        
    while (objParentObject.id=="" && objParentObject != null)
        objParentObject = objParentObject.parentElement;        
    
    if (objParentObject == null) return false;
    
    objParentObject.style.display="none";       
}

/* MoveHelp()
 * Moves the help box to the current mouse co-ordinates
 */
function MoveHelp() {    
	if (!(blnDraggable) || objParentObject == null) return;
	
	
	objParentObject.style.left = GetXCoordinate() - intOriginalXOffset;
	objParentObject.style.top = GetYCoordinate() - intOriginalYOffset;
	
}

/* GetXCoordinate()
 * Returns the current X coordinate of the mouse pointer.
 */
function GetXCoordinate() {
	return event.clientX + document.body.scrollLeft;			
}

/* GetYCoordinate()
 * Returns the current Y coordinate of the mouse pointer.
 */
function GetYCoordinate() {
	return event.clientY + document.body.scrollTop;			
}

/* ShowHelp()
 * Display the context sensitive help
 */
function ShowHelp( strPrefix, strTitle, strMessage ) {    
    var objContainer = document.getElementById(strPrefix + '_csh_container');
    var objTitle = document.getElementById(strPrefix + '_csh_Title');
    var objHelp = document.getElementById(strPrefix + '_csh_Description');
    
    objContainer.style.display = 'block';
    objTitle.innerHTML = strTitle;    
    objHelp.innerHTML = strMessage;    
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

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

Share

About the Author

Mahi2407
Web Developer
India India
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160826.1 | Last Updated 25 Sep 2006
Article Copyright 2006 by Mahi2407
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid