JavaScript DHTML/Security/Text Reverse

Материал из Web эксперт
Перейти к: навигация, поиск

This will reverse any text that you enter into it

<html>
  <head>
    <!--
      CryptoMX Tools
      Copyright (C) 2004 - 2006 Derek Buitenhuis
      This program is free software; you can redistribute it and/or
      modify it under the terms of the GNU General Public License
      as published by the Free Software Foundation; either version 2
      of the License, or (at your option) any later version.
      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU General Public License for more details.
      You should have received a copy of the GNU General Public License
      along with this program; if not, write to the Free Software
      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    -->
    <script language="JavaScript">
      function reverse() {
        text = "";
        str = document.forms[0].elements[0].value=document.forms[0].elements[0].value;
        for (i = 0; i <= str.length; i++)
        text = str.substring(i, i+1) + text;
        document.forms[0].elements[0].value = document.forms[0].elements[0].value = text;
      }
    </script>
  </head>
  <body bgcolor=#FFFFFF alink=#C0C0C0 link=#C0C0C0 vlink=#C0C0C0>
    <center>
      This will reverse any text that you enter into it.
      <br><br>
      <form>
        <textarea rows=10 cols=40 wrap="soft"></textarea><br>
        <input type=button value="Reverse" onClick="reverse()">
      </form>
    </center>
  </body>
</html>