All pastes #808465 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-12-07 17:09 UTC
rendered paste body
function divalert(id,text){
	// Detect if the browser is IE or not.
	// If it is not IE, we assume that the browser is NS.
	var IE = document.all?true:false
    var el = document.getElementById(id);
    var text;
	// Temporary variables to hold mouse x-y pos.s
	var tempX = 0
	var tempY = 0

	// If NS -- that is, !IE -- then set up for mouse capture
	if (!IE) document.captureEvents(Event.MOUSEMOVE)


	// Main function to retrieve mouse x-y pos.s

	  if (IE) { // grab the x-y pos.s if browser is IE
	    tempX = event.clientX + document.body.scrollLeft
    	tempY = event.clientY + document.body.scrollTop
	  } else {  // grab the x-y pos.s if browser is NS
	    tempX = e.pageX
    	tempY = e.pageY
  	}  
  	// catch possible negative values in NS4
    if (tempX < 0){tempX = 0}
  	if (tempY < 0){tempY = 0}  

    if(el){
        el.parentNode.removeChild(el);
    } else {
        var div = document.createElement('div');
        div.id = id;
        div.style.display='inline';
        div.style.top=tempY;
        div.style.left=tempX;
        div.className = "divalert";
        div.appendChild(document.createTextNode(text));
        document.getElementById('logo').appendChild(div);
        Fat.fade_element(id, 25, 500, '#E4EAD8', '#FFCC00');
    }
};