0% found this document useful (0 votes)
20 views

Reverse String

The document contains HTML code for a web page with a form that allows a user to enter a string in one text box. It includes JavaScript code for a reverse function that takes the string from the first text box, iterates through it backwards, and outputs the reversed string into the second text box when a button is clicked.

Uploaded by

adityanandwani
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Reverse String

The document contains HTML code for a web page with a form that allows a user to enter a string in one text box. It includes JavaScript code for a reverse function that takes the string from the first text box, iterates through it backwards, and outputs the reversed string into the second text box when a button is clicked.

Uploaded by

adityanandwani
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

<html> <head> <title>reversing a string</title> <script language="javascript"> function reverse(){ var a,b,i,sum; a=frm1.txt1.value; b=a.

length; sum=""; for(i=b-1;i>=0;i--) { sum=sum + a.charAt(i); } frm1.txt2.value=sum; } </script> </head> <body> <form id="frm1" name="frm1"> enter the string <input type="text" id="txt1" name="txt1"> <input type="text" id="txt2" name="txt2"> <br> <input type="button" value="reverse" onclick="reverse()"> </form> </body>

</html>

You might also like