
03/01/2006, 19:09
|
 | | | Fecha de Ingreso: mayo-2004 Ubicación: The Matrix
Mensajes: 223
Antigüedad: 20 años, 10 meses Puntos: 0 | |
Ya solucione el problema, pero ahora quiero que cuando este dentro de cierto rango de coordenadas se realice un evento como una funcion. Código HTML: <?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Documento sin título</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
.drag{
position:relative;
cursor:hand;
z-index: 100;
}
</style>
<script type="text/javascript">
/***********************************************
* Drag and Drop Script: © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
var dragobject={
z: 0, x: 0, y: 0, offsetx : null, offsety : null, targetobj : null, dragapproved : 0,
initialize:function(){
document.onmousedown=this.drag
document.onmouseup=function(){
this.dragapproved=0;
if (this.targetobj.style.left=="570px"){
if (this.targetobj.style.top="165px"){
window.status = "Left y Top";
alert("Eliminar");
}
else{
window.status="Solo Left";
return false;
}
}
else{
window.status="Ni Left ni Top";
return false;
}
}
},
drag:function(e){
var evtobj=window.event? window.event : e
this.targetobj=window.event? event.srcElement : e.target
if (this.targetobj.className=="drag"){
this.dragapproved=1
if (isNaN(parseInt(this.targetobj.style.left))){this.targetobj.style.left=0}
if (isNaN(parseInt(this.targetobj.style.top))){this.targetobj.style.top=0}
this.offsetx=parseInt(this.targetobj.style.left)
this.offsety=parseInt(this.targetobj.style.top)
this.x=evtobj.clientX
this.y=evtobj.clientY
if (evtobj.preventDefault){
evtobj.preventDefault()}
document.onmousemove=dragobject.moveit;
}
},
moveit:function(e){
var evtobj=window.event? window.event : e
if (this.dragapproved==1){
this.targetobj.style.left=this.offsetx+evtobj.clientX-this.x+"px";
this.targetobj.style.top=this.offsety+evtobj.clientY-this.y+"px";return false;
}
}
}
dragobject.initialize();
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<body bgcolor="#4477AA">
<img src="http://www.forosdelweb.com/images/vbulletin3_logo_fdw.gif" width="517" height="22" class="drag"/>
<div id="papelera" style="left: 580px;
top: 180px;
position: absolute;
width: 50px;
height: 20px;
z-index:100px;
background: #000000;">papelera</div>
</body>
</html>
__________________ HPNeo |