Klicke hier, um ein Beispiel zu sehen. Es öffnet sich ein kleines Fenster.
Hier ist der Quellcode: Direkt in den <Body> einfügen.
|
<center> <script LANGUAGE="JavaScript"> <!-- ... Quelle Dummy ... function rot_13() { alert("Diese Funktion erfordert JavaScript 1.1!") } // ... Ende Dummy ... --> </script><script LANGUAGE="JavaScript1.1"> <!-- ... Quelle Beispiel ... function rot_13(obj) { var keycode = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" var text = new String(obj.form.Text.value) var textrot = new String() for(var i = 0; i < text.length; i++) { var codechar = text.substring(i, i + 1) var pos = keycode.indexOf(codechar.toUpperCase()) if(pos >= 0) { pos = (pos + keycode.length / 2) % keycode.length codechar = (codechar == codechar.toUpperCase()) ? keycode.substring(pos, pos + 1) : keycode.substring(pos, pos + 1).toLowerCase() } textrot = textrot + codechar } obj.form.Text.value = textrot } // --> </script><form> <p><textarea NAME="Text" ROWS="5" COLS="60" WRAP="LOGICAL">Mailtext</textarea><br> <input TYPE="BUTTON" VALUE="ROT-13 Ver-/Entschlüsselung" onClick="rot_13(this)"> </p> </form> </center> |