Ver Mensaje Individual
  #3 (permalink)  
Antiguo 18/10/2008, 13:04
abigor66
 
Fecha de Ingreso: mayo-2008
Mensajes: 489
Antigüedad: 16 años
Puntos: 8
Respuesta: Como hacer un mensaje Flotante?

Gracias Buzu por tu tiempo. para los interesados acá un código en bruto que hace lo que estaba buscando. Digo en bruto porque lo hice fucionando codigos de diferentes aplicaciones y hasta ahora es que lo voy a personalizar y pulir.

Si alguien conoce una mejor manera de hacer esto, por favor publiquela acá para mejorar este codigo. jejeje

Código HTML:
<html>
<head>
<title>Dynamic Drive DHTML Scripts- Floating Menu Script</title>
<script language="JavaScript1.2">
isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function ddInit(e){
 topDog=isIE ? "BODY" : "HTML";
 whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer");  
 hotDog=isIE ? event.srcElement : e.target;  
 while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
   hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
 }  
 if (hotDog.id=="titleBar"){
   offsetx=isIE ? event.clientX : e.clientX;
   offsety=isIE ? event.clientY : e.clientY;
   nowX=parseInt(whichDog.style.left);
   nowY=parseInt(whichDog.style.top);
   ddEnabled=true;
   document.onmousemove=dd;
 }
}

function hideMe(){
 if (isIE||isNN) whichDog.style.visibility="hidden";
 else if (isN4) document.theLayer.visibility="hide";
}


document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");

</script>

</head>

<body style="height:1000px">
<script>
if (!document.layers)
document.write('<div id="divStayTopLeft" style="position:absolute">')
</script>

<layer id="divStayTopLeft">

<!-- BEGIN FLOATING LAYER CODE //-->
<div id="theLayer" style="position:absolute;width:250px;left:100;top:100;visibility:visible">
<table border="0" width="250" bgcolor="#424242" cellspacing="0" cellpadding="5">
<tr>
<td width="100%">
 <table border="0" width="100%" cellspacing="0" cellpadding="0" height="36">
 <tr>
 <td id="titleBar" width="100%">
 <ilayer width="100%" onSelectStart="return false">
 <layer width="100%" onMouseover="isHot=true;if (isN4) ddN4(theLayer)" onMouseout="isHot=false">
 <font face="Arial" color="#FFFFFF">Layer Title</font>
 </layer>
 </ilayer>
 </td>
 <td style="cursor:pointer" valign="top">
 <a href="#" onClick="hideMe();return false"><font color=#ffffff size=2 face=arial  style="text-decoration:none">X</font></a>
 </td>
 </tr>
 <tr>
 <td width="100%" bgcolor="#FFFFFF" style="padding:4px" colspan="2">
<!-- PLACE YOUR CONTENT HERE //-->  
Contenido Aki
<!-- END OF CONTENT AREA //-->
 </td>
 </tr>
 </table>
</td>
</tr>
</table>
</div>
<!-- END FLOATING LAYER CODE //-->
<!-- END OF CONTENT AREA //-->

</layer>


<script type="text/javascript">

/*
Floating Menu script-  Roy Whittle (http://www.javascript-fx.com/)
Script featured on/available at http://www.dynamicdrive.com/
This notice must stay intact for use
*/

//Enter "frombottom" or "fromtop"
var verticalpos="fromtop"

if (!document.layers)
document.write('</div>')

function JSFX_FloatTopDiv()
{
	var startX = 3,
	startY = 150;
	var ns = (navigator.appName.indexOf("Netscape") != -1);
	var d = document;
	function ml(id)
	{
		var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.left=x;this.style.top=y;};
		el.x = startX;
		if (verticalpos=="fromtop")
		el.y = startY;
		else{
		el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
		el.y -= startY;
		}
		return el;
	}
	window.stayTopLeft=function()
	{
		if (verticalpos=="fromtop"){
		var pY = ns ? pageYOffset : document.body.scrollTop;
		ftlObj.y += (pY + startY - ftlObj.y)/8;
		}
		else{
		var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
		ftlObj.y += (pY - startY - ftlObj.y)/8;
		}
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 10);
	}
	ftlObj = ml("divStayTopLeft");
	stayTopLeft();
}
JSFX_FloatTopDiv();
</script>
</body>

</html>