Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/12/2012, 04:19
edwintinieblas
 
Fecha de Ingreso: julio-2012
Mensajes: 3
Antigüedad: 11 años, 9 meses
Puntos: 2
Pregunta Problema con ejecución de javascript en mozilla

Hola buenas noches, de antemano gracias a quien me pueda ayudar en mi problema :P

Estoy haciendo una pagina con javascript donde se deberán mover diferentes div's al mismo tiempo cuando los arrastres con el cursor, hasta ahorita todo va bien, o bueno casi bien :(

Mi problema en sí es que no me quiere correr en mozilla, ya lo probé en IE, Chrome y Safari, el único que no me resulta es Mozilla, no se por que, pongo el código a ver si alguien me puede ayudar :D

Como dije, gracias de antemano.

Código HTML:
<html>

<head>

<style type="text/css">

	.objMovible { position:absolute; cursor:pointer }

</style>

<script type="text/javascript">

	var estoyArrastrando = false;
	var obj;
	var obj1;
	var a_des;
	var p_des;
	var pos_obj;
	var pos_obj_1;

	function presionarBoton() {

		estoyArrastrando = true;
		obj = document.getElementById('div_');
		obj1 = document.getElementById('div_1');
		a_des = event.clientX;
		pos_obj = parseInt(obj.style.left);
		pos_obj_1 = parseInt(obj1.style.left);
		return false;

	}

	document.onmousedown = presionarBoton;

	function arrastrarRaton(){

		if (estoyArrastrando) {

			p_des = event.clientX;

			if (((pos_obj>0)&&(pos_obj_1>0))||((pos_obj<0)&&(pos_obj_1<0))) { 

				obj.style.left = (p_des - a_des) + pos_obj;
				obj1.style.left = (p_des - a_des) + pos_obj_1;

			} else {

				obj.style.left = (p_des - a_des);
				obj1.style.left = (p_des - a_des);

			}

			return false;

		}

	}

	document.onmousemove = arrastrarRaton;

	function soltarBoton() {	

		estoyArrastrando = false;

	}

	document.onmouseup = soltarBoton;

</script>

</head>

<body>

<div  id="div_" class="objMovible" style="top:200px;width:200px;height:20px;background-color:#CC0000"></div>
<div  id="div_1" class="objMovible" style="width:200px;height:20px;background-color:#CC0000"></div>

</body>
</html>