Ver Mensaje Individual
  #5 (permalink)  
Antiguo 25/10/2011, 20:57
Avatar de jor_0203
jor_0203
 
Fecha de Ingreso: octubre-2011
Ubicación: mexico
Mensajes: 760
Antigüedad: 12 años, 6 meses
Puntos: 8
Respuesta: en un formulario hay una forma que cuando seleccione una palabra le pueda

prueben este codigo
<!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>Editor de texto</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<script language="JavaScript">
function Inicializar()
{
editor.document.designMode = 'On';
}
function Negrita()
{
editor.document.execCommand('bold', false, null);
}
function Copiar()
{
editor.document.execCommand('copy',false, null);
}
function Cortar()
{
editor.document.execCommand('cut',false, null);
}
function Pegar()
{
editor.document.execCommand('paste',false, null);
}
function Italica()
{
editor.document.execCommand('italic',false, null);
}
function Subrayado()
{
editor.document.execCommand('underline',false, null);
}
function Enlace()
{
editor.document.execCommand('CreateLink');
}

</script>

</head>
<body onLoad="Inicializar()">

<form name="form1" id="form1" method="post" action="">
<h3>Editor de texto</h3>
<p> <a onclick="Copiar()">copiar</a>
<a onclick="Cortar()">cortar</a>

<a onclick="Italica()">italica</a>
<a onclick="Enlace()">enlace</a>
<a onclick="Negrita()">negrita</a>
<a onclick="Pegar()">pegar</a>
<a onclick="Subrayado()">subrayado</a>


</p>

</form>
<iframe id="editor" name="editor" style="width: 500px; height:500px" scrolling="auto" frameborder="1"></iframe>

</body>
</html>

Última edición por jor_0203; 25/10/2011 a las 22:58