Thanx jaredn,
this was actually helpful to me,
but I had something like this before:
<html>
<head>
<title>Dies ist kein Formular</title>
<script>
document.onkeypress = steuern;
function steuern(e){
switch(event.keyCode){
case 13 : mywrite = "<br>"; //13 == RETURN KEY
break;
case "<" : mywrite = "<";
break;
case ">" : mywrite = ">";
break;
default : mywrite = String.fromCharCode(event.keyCode);
}//switch
writeIt(mywrite);
}//of function steuern
function writeIt(mytext){
document.getElementById('tafel').innerHTML+=mytext;
}//of function writeIt
function setAttribute(what){
for (i=0; i<laenge;i++){
alert("feld "+i+" "+zerPflueckt
);
}//for
document.selection.createRange().pasteHTML("<"+what+">"+document.selection.createRange().text+"</"+what+">"
;
}//of function setAttribute
function fett(e){
setAttribute('b');
}//of function fett
function kursiv(e){
setAttribute('i');
}//of function kursiv
function unterStr(e){
setAttribute('u');
}//of function unterStr
</script>
</head>
<body onload="window.focus()">
<form action="" method="" name="formatText">
<input type="Button" value="FETT" onclick="fett()">
<input type="Button" value="Kursiv" onclick="kursiv()">
<input type="Button" value="Unterstrichen" onclick="unterStr()">
</form>
<div id="tafel">
Write here:<br>
</div>
</body>
</html>
My Problem is the switch I used there:
I can get the code of the return-key (13)
and of all charcters,
but important things like "backspace"
and don't work,
also I havn't seen a "<" so far in my document.
IE interprets backspace, before I get it into my eventhandler - function.
By the way:
I'm sorry for the german names of the variables and functions:
it's a bad habit. ;-)
Regards,
Buraje