Ver Mensaje Individual
  #3 (permalink)  
Antiguo 18/11/2004, 11:26
dovi
 
Fecha de Ingreso: noviembre-2004
Mensajes: 2
Antigüedad: 19 años, 6 meses
Puntos: 0
Muchas gracias Javier, me fue de gran utilidad. Dejo el codigo por si alguien lo necesita, lo he probado con firefox 1.0, netscape 7.2, Opera e IE. Por cierto no me acaba de convencer como detecto el browser, como lo tengo implementado funciona pero si alguien sugiere alguna mejor lo agradeceria. Gracias!!


<SCRIPT type="text/javascript">
<!-- Begin
// Determine browser and version.
function Browser() {

var ua, s, i;

this.isIE = false;
this.isNS = false;

this.version = null;

ua = navigator.userAgent;

s = "MSIE";
if ((i = ua.indexOf(s)) >= 0) {
this.isIE = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}

s = "Netscape6/";
if ((i = ua.indexOf(s)) >= 0) {
this.isNS = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}

// Treat any other "Gecko" browser as NS 6.1.

s = "Gecko";
if ((i = ua.indexOf(s)) >= 0) {
this.isNS = true;
this.version = 6.1;
return;
}
}

var browser = new Browser();

function actualizarPosicion(event)
{
var X
var Y
if (browser.isIE){ // IE & Opera
X = event.clientX + document.body.scrollLeft
Y = event.clientY + document.body.scrollTop
}
else if (browser.isNS){
if (browser.version == 6.1 ) // Netscape 6.1 or higher (7.2 funciona) y Firefox
{
X = event.clientX + window.scrollX;
Y = event.clientY + window.scrollY;
}
}
else
alert("Tu navegador puede no soportar esta página web. Lo sentimos.")

}
//-->
</script>