Ver Mensaje Individual
  #5 (permalink)  
Antiguo 17/02/2008, 17:47
Avatar de Panino5001
Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años, 9 meses
Puntos: 834
Re: Borrar texto seleccionado de textarea

Con el enlace que te pasó caricatos tenés más que suficiente como para borrar la selección en el textarea. No obstante, no sé si te conviene usar un textarea para eso. Fijate si te sirve esto:
Código PHP:
<!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>TEST</title>
<
script>
function 
agregar(N,V){
if(
N.length<|| V.length<){
alert('completar');
return;
}
NN=document.getElementsByTagName('option').length;
var 
op=new Option(N+':'+V,N+':'+V);
document.form1.lista[NN]=op;
}
function 
quitar(I){
s=false;
if(
I>-1){
var 
op=document.getElementsByTagName('option');

for(
i in op){
    if(
op[i].selected){
        
s=true;
        break;
    }
}
}
if(!
s){
alert('no hay valores seleccionados')
return;
}
document.getElementById('lista').removeChild(document.getElementsByTagName('option')[I]);
document.getElementById('lista').selectedIndex=-1;
}
</script>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="16%"><div align="right">parametro nombre 
          <input name="nombre" type="text" id="nombre" />
      </div></td>
      <td width="13%">&nbsp;</td>
      <td width="71%" rowspan="4"><select name="lista" size="5" id="lista">
       
      </select>
      </td>
    </tr>
    <tr>
      <td rowspan="2"><div align="right">parametro valor 
          <input name="valor" type="text" id="valor" />
      </div></td>
      <td><div align="center">
        <input type="button" name="Submit" value="agregar--&gt;" onclick="agregar(nombre.value,valor.value)" />
      </div></td>
    </tr>
    
    <tr>
      <td><div align="center">
        <input type="button" name="Submit2" value="&lt;--quitar" onclick="quitar(lista.selectedIndex)" />
      </div></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>
</body>
</html> 

Última edición por Panino5001; 17/02/2008 a las 17:57