Return to Snippet

Revision: 80316
at March 5, 2020 08:37 by dertimbo


Updated URL

                                

Revision: 362
at July 11, 2006 14:08 by dertimbo


Updated Code
// ## LoadingMessage
// ## Version: 0.6
// ## Author: Tim Isenheim - http://blog.freshlabs.de 

var LoadingMessage = {
imageURL : 'ajax-loader.gif',
waitImg : null,
containerId : "loading-message",
loadTextId : "loading-text",
waitImgId : "loading-image",
waitImgWidth : 16,
waitImgHeight : 16,

init : function(){
	this.waitImg = document.createElement('img');
	this.waitImg.setAttribute('src', this.imageURL);
	this.waitImg.setAttribute('height', this.waitImgHeight);
	this.waitImg.setAttribute('width', this.waitImgWidth);
	this.waitImg.setAttribute('alt','loading...');
	this.waitImg.id = this.waitImgId;
	this.waitImg.style.border = '0';
	this.waitImg.style.backgroundColor = 'transparent';
	this.waitImg.style.margin = '0';
	this.waitImg.style.padding = '0';
},
	
append : function(where){
	var parent = $(where);
	var loadbox;
	if(!$(this.containerId)){
		loadbox = document.createElement('div');
		var loadtext = document.createElement('div')
		loadbox.id = this.containerId;
		loadtext.id = this.loadTextId;
		txt = document.createTextNode(" loading");
		loadtext.appendChild(this.waitImg);
		loadtext.appendChild(txt);
		loadbox.appendChild(loadtext);
	}
	else loadbox = $(this.containerId);
	loadbox.style.display = "none";
	new Effect.Appear(loadbox, { to: 0.7, queue: 'end' });
	parent.appendChild(loadbox);
},
	
remove : function(){
	new Effect.Fade(this.containerId, {duration: 0.25, queue: 'end' });
}

} // ### .LoadingMessage


// Attaching the init function to the window.onload event
Event.observe(window,'load', function(){
    LoadingMessage.init();
});

Revision: 361
at July 11, 2006 14:06 by dertimbo


Initial Code
// ## LoadingMessage
// ## Version: 0.6
// ## Author: Tim Isenheim - http://blog.freshlabs.de 

var LoadingMessage = {
imageURL : 'ajax-loader.gif',
waitImg : null,
containerId : "loading-message",
loadTextId : "loading-text",
waitImgId : "loading-image",
waitImgWidth : 16,
waitImgHeight : 16,

// call this function within the window.onload event	
init : function(){
	this.waitImg = document.createElement('img');
	this.waitImg.setAttribute('src', this.imageURL);
	this.waitImg.setAttribute('height', this.waitImgHeight);
	this.waitImg.setAttribute('width', this.waitImgWidth);
	this.waitImg.setAttribute('alt','loading...');
	this.waitImg.id = this.waitImgId;
	this.waitImg.style.border = '0';
	this.waitImg.style.backgroundColor = 'transparent';
	this.waitImg.style.margin = '0';
	this.waitImg.style.padding = '0';
},
	
append : function(where){
	var parent = $(where);
	var loadbox;
	if(!$(this.containerId)){
		loadbox = document.createElement('div');
		var loadtext = document.createElement('div')
		loadbox.id = this.containerId;
		loadtext.id = this.loadTextId;
		txt = document.createTextNode(" loading");
		loadtext.appendChild(this.waitImg);
		loadtext.appendChild(txt);
		loadbox.appendChild(loadtext);
	}
	else loadbox = $(this.containerId);
	loadbox.style.display = "none";
	new Effect.Appear(loadbox, { to: 0.7, queue: 'end' });
	parent.appendChild(loadbox);
},
	
remove : function(){
	new Effect.Fade(this.containerId, {duration: 0.25, queue: 'end' });
}

} // ### .LoadingMessage

Initial URL
http://www.freshlabs.de/journal/archives/2006/07/ajax-loadingmessage-in-json/

Initial Description
Creates a notification message for AJAX requests.
Dependencies: prototype.js, script.aculo.us.

CSS-Styles: http://snipplr.com/view/348/loadingmessage-for-ajax-requests-css/

Initial Title
LoadingMessage for AJAX requests

Initial Tags
ajax

Initial Language
JavaScript