|
↑
Forms >>>
Format the text case inside a form, reverse the text, or see the ASCII code behind the input.
Add the below code to the <body> section of your page:
<script
language="javascript"
type="text/javascript">
function
reverse()
{
text
=
"";
str
=
document.format.elements[0].value=document.format.elements[0].value;
for
(i
=
0;
i <=
str.length;
i++)
text
=
str.substring(i,
i+1)
+
text;
document.format.elements[0].value
=
document.format.elements[0].value
=
text;
}
function
lower()
{
document.format.elements[0].value
=
document.format.elements[0].value.toLowerCase()
}
function
caps()
{
document.format.elements[0].value
=
document.format.elements[0].value.toUpperCase()
}
function
whatIsThis()
{
document.format.elements[0].value
=
escape(document.format.elements[0].value)
}
function
dontLikeThis()
{
document.format.elements[0].value
=
unescape(document.format.elements[0].value)
}
var
t =
new
Array();
t[0]
=
"Here is some text to use as an
example. Click on reverse, uppercase, or lowercase.";
function
example()
{
for(var
i =
0;
i <
2;
i++)
{
if(document.format.elements[i].value)
{
document.format.elements[0].value
=
document.format.elements[0].value+unescape(t[0]);
}
}
}
var
f =
new
Array();
f[0]
=
"%3Ca%20href%3D%27http%3A//www.yaldex.com%27%3E%3Cimg%20src%3D%22http%3A//www.yaldex.com/img/logo.gif%22%20alt%3D%27The%20JavaScript%20Source%21%27%20border%3D0%3E%3C/a%3E";
function
exAscii()
{
for(var
i =
0;
i <
2;
i++)
{
if(document.format.elements[i].value)
{
document.format.elements[0].value
=
document.format.elements[0].value+unescape(f[0]);
}
}
}
</script>
<form
action=""
method="post"
name="format">
<textarea
rows=10
cols=40
wrap=soft></textarea>
<table
border=0><center>
<tr><td>
<input
type=button
value="Example"
onClick="example(this.form)">
<input
type=button
value="Reverse"
onClick="reverse()">
<input
type=button
value="All
Upper"
onClick="caps()">
<input
type=button
value="All
Lower"
onClick="lower()">
</td>
</tr>
<tr>
<td>
<input
type=button
value="Ascii
Example"
onClick="exAscii()">
<input
type=button
value="UnAscii"
onClick="dontLikeThis()">
<input
type=button
value="Ascii"
onClick="whatIsThis()">
<input
type=button
value="Clear
It"
onClick="reset()">
</td>
</tr>
</table>
</form>
|
→ online casino
|