Character and string flip using JavaScript programming

Source: Internet
Author: User

I wrote this at noon today when I decrypted a webpage Trojan ......

It mainly uses the javascript string split method, array reverse and join method.

<HTML>
<Head>
<Title> character and string flip using JavaScript programming </title>
<Meta name = "author" content = "purpleendurer">
</Head>
<Body>
<Form name = "FRT">
Source string: <input type = "checkbox" name = "ckbrow"> line flip </input> <input type = "checkbox" name = "ckbchar"> Line Character flip </input> <button onclick = "reverseall () "> processing </button> <br>
<Textarea name = "tas" rows = "12" Cols = "90">
D321
C321
B321
A543
</Textarea> <br>
Conversion Result: <br>
<Br> <textarea name = "tar" rows = "12" Cols = "90"> </textarea>
</Form>
<Script language = JavaScript>
Function reverseall ()
{
VaR S1 = Document. FRT. TAS. value;
VaR AS1 = s1.split ("/N"); // divides data into arrays by row
If (true = Document. FRT. ckbrow. Checked)
{
AS1 = as1.reverse (); // flip between lines
}
VaR S2 = "";
If (true = Document. FRT. ckbchar. Checked)
{
// Line Character flip
VaR I, T, T1;
For (I = 0; I <as1.length; I ++)
{
T = AS1 [I]. Split (''); // divides characters into arrays.
T1 = T. Reverse (); // In-row character flip
S2 + = t1.join ('');
}
/* Another Implementation Method
For (I = 0; I <as1.length; I ++)
{
T = AS1 [I]. Split ('');
T1 = T. Reverse ();
S2 + = t1.join ('');
}
*/
S2 = s2.substr (1 );
}
Else
{
S2 = as1.join ("");
}
Document. FRT. Tar. value = S2;
}
// Line flip
Function reverserows ()
{
VaR S1 = Document. FRT. TAS. value;
VaR as0 = s1.split ("/N"); // divide the array by row
VaR AS1 = as0.reverse (); // array flip
Document. FRT. Tar. value = as1.join ("");
}
// Line Character flip
Function reversechar ()
{
VaR S1 = Document. FRT. TAS. value;
VaR as0 = s1.split ("/N ");
VaR S2 = "", I, T, T1;
For (I = 0; I <as0.length; I ++)
{
T = as0 [I]. Split (''); // divides characters into arrays.
T1 = T. Reverse ();
S2 + = t1.join ('');
}
/* Another Implementation Method
VaR S2 = "", I, T, T1;
For (I = 0; I <as0.length; I ++)
{
T = as0 [I]. Split ('');
T1 = T. Reverse ();
S2 + = t1.join ('');
}
*/
        document.frT.taR.value = s2.substr(1);
}
</script>
</body>
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.