diff options
author | RossTheRoss <mstrapp@protonmail.com> | 2021-04-15 11:36:55 -0500 |
---|---|---|
committer | RossTheRoss <mstrapp@protonmail.com> | 2021-04-15 11:36:55 -0500 |
commit | e1994b6e0342913696f94eec1a4a6b0685e3a015 (patch) | |
tree | fe065d851ca3e276c8bbc9cc78f1c6b77777c129 /csci4131/hw6/strap012_hw6/public/contacts.html | |
parent | Rearrange (diff) | |
download | homework-e1994b6e0342913696f94eec1a4a6b0685e3a015.tar homework-e1994b6e0342913696f94eec1a4a6b0685e3a015.tar.gz homework-e1994b6e0342913696f94eec1a4a6b0685e3a015.tar.bz2 homework-e1994b6e0342913696f94eec1a4a6b0685e3a015.tar.lz homework-e1994b6e0342913696f94eec1a4a6b0685e3a015.tar.xz homework-e1994b6e0342913696f94eec1a4a6b0685e3a015.tar.zst homework-e1994b6e0342913696f94eec1a4a6b0685e3a015.zip |
hw6
Diffstat (limited to 'csci4131/hw6/strap012_hw6/public/contacts.html')
-rw-r--r-- | csci4131/hw6/strap012_hw6/public/contacts.html | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/csci4131/hw6/strap012_hw6/public/contacts.html b/csci4131/hw6/strap012_hw6/public/contacts.html new file mode 100644 index 0000000..15e4032 --- /dev/null +++ b/csci4131/hw6/strap012_hw6/public/contacts.html @@ -0,0 +1,73 @@ +<html>
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
+ <script type="text/javascript" defer>
+ //Get JSON
+ var xmlhttp = new XMLHttpRequest();
+ var url = "contacts.json";
+ xmlhttp.onreadystatechange = function () {
+ if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
+ var parse = JSON.parse(xmlhttp.responseText);
+ process(parse);
+ }
+ }
+ xmlhttp.open("GET", url, true);
+ xmlhttp.send();
+
+ function process(a) {
+ var table = document.getElementsByTagName("tbody")[0];
+ var contacts = a.contacts;
+ for (let i = 0; i < contacts.length; i++) {
+ var contact = contacts[i];
+ var row = table.insertRow();
+ for (var j in contact) {
+ if (j != "website_url") {
+ var value = row.insertCell();
+ value.innerHTML = contact[j];
+ } else {
+ var url = row.insertCell();
+ url.innerHTML = "<a href =" + contact[j] + ">" + contact[j] + "</a>";
+ }
+ }
+ }
+ }
+
+ </script>
+ </head>
+ <body>
+ <nav class="navbar navbar-default">
+ <div class="container-fluid">
+ <ul class="nav navbar-nav">
+ <li><a href="index.html"><b>Home</b></a></li>
+ <li><a href="contacts.html"><b>Contacts</b></a></li>
+ <li><a href="addContact.html"><b>Add Contact</b></a></li>
+ <li><a href="stock.html"><b>Stock Page</b></a></li>
+ </ul>
+ </div>
+ </nav>
+ <br><br>
+
+ <div class="container">
+ <table class="table" id="contactsTable">
+ <thead>
+ <tr>
+ <th scope="col">Name</th>
+ <th scope="col">Category</th>
+ <th scope="col">Location</th>
+ <th scope="col">Contact Information</th>
+ <th scope="col">Email</th>
+ <th scope="col">Website <br> (URL) </th>
+ </tr>
+ </thead>
+ <tbody></tbody>
+ </table>
+ </div>
+ <script type="text/javascript">
+
+ </script>
+ </body>
+</html>
|