Ver Mensaje Individual
  #9 (permalink)  
Antiguo 05/05/2004, 02:59
Avatar de epplestun
epplestun
 
Fecha de Ingreso: octubre-2001
Mensajes: 1.621
Antigüedad: 23 años, 3 meses
Puntos: 5
Bueno .... algo e conseguido hacer .... es decir, añadirle el evento pero bueno es una chapucilla:

Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Untitled</title>
</head>

<body>
<div id="menu" style="position: absolute; width: 150px; height: 300px; visibility: hidden; background-color: #f2f2f2" onMouseOut="this.style.visibility='hidden'"></div>
<div id="area">
<script type="text/javascript">
document.oncontextmenu = function() {
	alert("Boton derecho en el documento");
	return false;
}

var area     = document.getElementById('area');
var iframe   = document.createElement("iframe");
iframe.setAttribute('id','iframe');
iframe.style.width  = "400";
iframe.style.height = "400";

function init() {
	var doc = iframe.contentWindow.document;
	doc.designMode = "on";
}
setTimeout(init, 100);

area.appendChild(iframe);

with(document.getElementById('iframe').contentWindow.document) {
	clear();
	open();
	write("<html><body></body></html>");
	close();
}

var e = document.getElementById('iframe').contentWindow.document;
var evento = "click";

//alert(e);
var doc = self.document.getElementById('iframe').contentWindow;
_addEvent(doc, "contextmenu", function () { document.getElementById('menu').style.visibility="visible"; alert(); return false;});


function _addEvent(el, ev, func) {
	if(document.all) {
		el.attachEvent("on" + ev, func);
	} else {
		el.addEventListener(ev, func, true);
	}
}
</script>
</div>
</body>
</html>
El problema es que solo funciona bajo Mozilla
__________________
Usuario registrado de Linux #288725