qualcuno mi sa dire come posso completare?
probabilmente bisogna usare selection e range del DOM, ma non c'ho capito una ceppa
denghiù

codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="it">
	<head>
		<script type="text/javascript">
		var censura = array('peppe', 'chiatte', 'bulinaria');
		
		function censura()
		{
				//ad ogni "key press" voglio controllare il testo ed eventualmente evidenziare le parole dell'array censura

				
				
				
				
				
				
				
				document.getElementById("edit").contentWindow.execCommand('forecolor',false,'#DE002F');
		}
		
		function start()
		{
			editbox = document.getElementById('edit');
			editbox.contentWindow.document.designMode = "on";
			
			try
			{editbox.contentWindow.document.execCommand("undo", false, null);}
			catch(e)
			{alert("This demo is not supported on your level of Mozilla.");	}
			
			if(document.addEventListener)
			{
				document.addEventListener("keypress", censura, true);
				editbox.contentWindow.document.addEventListener("keypress", censura, true);
		  	}
			else if (document.attachEvent)
			{
				document.attachEvent("onkeypress", censura, true);
    			editbox.contentWindow.document.attachEvent("onkeyup", censura, true);
			}
		}
		</script>
	</head>
	<body xml:lang="it" onload="start();">
		<iframe id="edit" width="100%" height="200px"></iframe>
		<button onclick="alert(document.getElementById('edit').contentWindow.document.body.innerHTML);">prova</button>
	</body>
</html>