Skip to content

Commit e0a6b48

Browse files
committed
Update index.html
1 parent 7414747 commit e0a6b48

File tree

1 file changed

+27
-37
lines changed

1 file changed

+27
-37
lines changed

web/index.html

Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,36 @@
11
<!DOCTYPE HTML>
22
<html>
33
<head>
4-
<title> My Programs in JavaScript </title>
5-
<script>
6-
7-
function captwords() {
8-
9-
var fs ="";
10-
var list="z6amTPcq z1UiI 6sS0DNaXdzwszSsLw4W8JxsDIH5LXPPQ"+"<br>"+"VfTuw5dIL9QyUP bMuP JWkasF GE9jhXLo9lnAbPfYoH";
11-
list.split("\n").forEach( function(line){
12-
if(line !== "") {
13-
var words = line.split(" ");
14-
for(var i = 0; i < words.length; ++i){
15-
var letter = words[i][0];
16-
17-
if(letter <= 'z'&& letter >= 'a'){
18-
letter = String.fromCharCode(letter.charCodeAt()-32);
19-
}
20-
21-
//alert("Caught: "+" \n "+letter+" in "+words[i]);
22-
fs = fs + letter + words[i].substr(1) + " ";
23-
}
24-
25-
fs = fs + "<br>";
26-
}
27-
28-
});
29-
30-
document.getElementById("demo").innerHTML="Input: "+"<br>"+list;
31-
document.getElementById("result").innerHTML="Results: "+"<br>"+fs;
32-
}
33-
</script>
4+
<title> My Programs in JavaScript</title>
5+
<script src="sources/captwords.js"></script>
6+
<script src="sources/listelement.js"></script>
347
</head>
358

369
<body>
37-
38-
39-
<p id="demo">Result</p> <br><br>
40-
<p id="result">Answer</p>
41-
42-
<button type="button" onclick="captwords()">My Capitalize Words function!</button>
43-
10+
<h3> Access Element by ID </h3>
11+
<p> The following example takes in input as an argument to the JavaScript text
12+
by using document.getElementById() and capitalizes all words.</p>
13+
14+
<input type='text' id='capwords' value='enter text here to capitalize!'></input>
15+
<input type="button" onclick="captwords()" value="My Capitalize Words function!"></input>
16+
17+
<!--<p id="capwords">z6amTPcq z1UiI 6sS0DNaXdzwszSsLw4W8JxsDIH5LXPPQ<br>
18+
VfTuw5dIL9QyUP bMuP JWkasF GE9jhXLo9lnAbPfYoH</p> <br><br> -->
19+
20+
<p id="result">Result</p>
21+
22+
23+
24+
25+
<h3> Limit Search by Parent Element</h3>
26+
<ol id="people">
27+
<li>John</li>
28+
<li>Rodger</li>
29+
<li>Hugo</li>
30+
</ol>
31+
32+
<button type="button" onclick="listelement()">List First li Element!</button>
33+
<p id="result1">Result</p>
4434
</body>
4535

4636

0 commit comments

Comments
 (0)