Skip to content

Commit 6db495e

Browse files
committed
init
0 parents  commit 6db495e

File tree

4 files changed

+127
-0
lines changed

4 files changed

+127
-0
lines changed

Reverse.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//Use a for loop
2+
function reverseA(str) {
3+
let reversed = "";
4+
for(var i = str.length-1;i >= 0; i--){
5+
reversed += str[i];
6+
}
7+
return reversed;
8+
}
9+
10+
//Use Built in Functions
11+
function reverseB(str){
12+
return str.split("").reverse().join("");
13+
}
14+
15+
//Call and use it.
16+
function revMe(){
17+
let revresed = "";
18+
var str = document.getElementById('value').value;
19+
reversed = reverseB(str)
20+
document.getElementById('result').innerHTML = reversed;
21+
}

ReverseAstring.png

13.8 KB
Loading

index.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Revrse A String</title>
8+
<script src="Reverse.js"></script>
9+
<link rel="stylesheet" type="text/css" href="style.css">
10+
</head>
11+
<body>
12+
<img src="ReverseAstring.png" alt="Nature" class="responsive">
13+
<div class="rev-style">
14+
<div class="rev-style-heading">Enter a String to Be Reversed</div>
15+
<label ><span>Enter a String:</span><input id="value" type="text" name="reverseME"></label>
16+
<label ><span>Results:</span>
17+
<textarea id="result" name="results" class="textarea-field"></textarea>
18+
</label>
19+
<label><span></span><input onclick="revMe()" type="submit" value="Revers Me" /></label>
20+
21+
</div>
22+
</body>
23+
</html>

style.css

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
.responsive {
2+
max-width: 100%;
3+
height: auto;
4+
}
5+
.rev-style{
6+
max-width: 700px;
7+
padding: 20px 12px 10px 20px;
8+
font: 18px Arial, Helvetica, sans-serif;
9+
}
10+
.rev-style-heading{
11+
font-weight: bold;
12+
font-style: italic;
13+
border-bottom: 2px solid #ddd;
14+
margin-bottom: 20px;
15+
font-size: 20px;
16+
padding-bottom: 3px;
17+
}
18+
.rev-style label{
19+
display: block;
20+
margin: 0px 0px 15px 0px;
21+
}
22+
.rev-style label > span{
23+
width: 200px;
24+
font-weight: bold;
25+
float: left;
26+
padding-top: 0px;
27+
padding-right: 5px;
28+
}
29+
.rev-style span.required{
30+
color:red;
31+
}
32+
.rev-style .tel-number-field{
33+
width: 40px;
34+
text-align: center;
35+
}
36+
.rev-style input.input-field, .rev-style .select-field{
37+
width: 48%;
38+
}
39+
.rev-style input.input-field,
40+
.rev-style .tel-number-field,
41+
.rev-style .textarea-field,
42+
.rev-style .select-field{
43+
box-sizing: border-box;
44+
-webkit-box-sizing: border-box;
45+
-moz-box-sizing: border-box;
46+
border: 1px solid #C2C2C2;
47+
box-shadow: 1px 1px 4px #EBEBEB;
48+
-moz-box-shadow: 1px 1px 4px #EBEBEB;
49+
-webkit-box-shadow: 1px 1px 4px #EBEBEB;
50+
border-radius: 3px;
51+
-webkit-border-radius: 3px;
52+
-moz-border-radius: 3px;
53+
padding: 7px;
54+
outline: none;
55+
}
56+
.rev-style .input-field:focus,
57+
.rev-style .tel-number-field:focus,
58+
.rev-style .textarea-field:focus,
59+
.rev-style .select-field:focus{
60+
border: 1px solid #0C0;
61+
}
62+
.rev-style .textarea-field{
63+
height:100px;
64+
width: 55%;
65+
}
66+
.rev-style input[type=submit],
67+
.rev-style input[type=button]{
68+
border: none;
69+
padding: 8px 15px 8px 15px;
70+
background: #f7941d;
71+
color: #fff;
72+
box-shadow: 1px 1px 4px #DADADA;
73+
-moz-box-shadow: 1px 1px 4px #DADADA;
74+
-webkit-box-shadow: 1px 1px 4px #DADADA;
75+
border-radius: 3px;
76+
-webkit-border-radius: 3px;
77+
-moz-border-radius: 3px;
78+
}
79+
.rev-style input[type=submit]:hover,
80+
.rev-style input[type=button]:hover{
81+
background: #EA7B00;
82+
color: #fff;
83+
}

0 commit comments

Comments
 (0)