04/10/2009, 12:40
|
| Me alejo de Omelas | | Fecha de Ingreso: mayo-2004 Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años, 8 meses Puntos: 834 | |
Respuesta: obtener valor del texto seleccionado Fijate si te sirve:
Código:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<script>
function seleccion(){
if(window.getSelection!= 'undefined' && window.getSelection){
return window.getSelection();
}else if(document.selection != 'undefined' && document.selection ){
return document.selection.createRange().text;
}else{
return null;
}
}
function mostrar(e){
var evt=e || event;
if(evt.which == 3 || evt.button==2){
alert(seleccion());
}
}
function addEvent(obj,fun,type){
if(obj.addEventListener){
obj.addEventListener(type,fun,false);
}else if(obj.attachEvent){
var f=function(){
fun.call(obj,window.event);
}
obj.attachEvent('on'+type,f);
obj[fun.toString()+type]=f;
}else{
obj['on'+type]=fun;
}
}
onload=function(){
addEvent(document,mostrar,'mousedown');
addEvent(document,function(e){if(e.preventDefault)e.preventDefault();else e.returnValue=false;},'contextmenu');
}
</script>
</head>
<body>
esto es un ejemplo
</body>
</html>
|