-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhw6part3.html
More file actions
88 lines (76 loc) · 3.4 KB
/
hw6part3.html
File metadata and controls
88 lines (76 loc) · 3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<!DOCTYPE html>
<html lang="en">
<head>
<!--Kristian Reyes 11/10/2020 -->
<title>CNIT 133 Homework 6</title>
<meta charset="utf-8">
<meta name="description" content="homework 6 for CCSF CNIT 133">
<meta name="keywords" content="HTML, CSS, Javascript, CCSF, Student">
<meta name="author" content="Kristian Reyes">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<!--bootstrap -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.10/jquery.mask.js"
></script>
<script>
$(document).ready(function(){
$('.phone').mask('(000) 000-0000');
});
</script>
<script>
function parseNumber()
{
var phoneNumber = document.getElementById("phone").value
var area = phoneNumber.split('(')[1].split(')')[0];
var three = phoneNumber.split(' ')[1].split('-')[0];
var four = + phoneNumber.split(' ')[1].split('-')[1];
document.getElementById("areacode").value = "The area code is " + area;
document.getElementById("firstthree").value = "The first three numbers are " + three;
document.getElementById("lastfour").value = "The last four numbers are " + four;
};
</script>
</head>
<body>
<main class="grid">
<header class="grid-area grid-area-1">
<h2> Homework 6 - Part 3 </h2>
</header>
<nav class="grid-area grid-area-2">
<ul>
<li>
<a href="homework6.html" title="CNIT 133 - HW 6 ">
Return to CNIT 133 Homework 6 - Objects
</a>
</li>
</ul>
</nav>
<section class="grid-area grid-area-3">
<h2> Part 3</h2>
<form name="myForm">
<h3>Enter a telephone number:</h3>
<p>
<label>Phone Number:
<input type="text" id="phone" name="phone" class="phone" />
</label>
<br><br>
<input type="button" value="Go" onclick="parseNumber()">
<input type="reset" value="Reset" onclick="location.reload();">
</p>
</form>
<h3>Sections of your number:</h3>
<textarea name="areacode" id="areacode" rows="3" cols="30" readonly></textarea>
<textarea name="firstthree" id="firstthree" rows="3" cols="30" readonly></textarea>
<textarea name="lastfour" id="lastfour" rows="3" cols="30" readonly></textarea>
</section>
<footer class="grid-area grid-area-4">
<p>
© 2020 Kristian Reyes
</p>
</footer>
</main>
</body>
</html>