JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<body>
<form name="form1" method="post" action="createTable();return myFunction();">
<h1><b>Crawler Configuration</b></h1>
<p>Required fields are followed by <strong><abbr title="required">*</abbr></strong>
</p>
<center>
<label for="domain"> <span>Domain: </span>
</label>
<input type="text" list="Domaindata" name="DomainName" id="Domain_name" required="" />
<datalist id="Domaindata">
<option value="Music" />
<option value="Application" />
<option value="News" />
<option value="Weather" />
<option value="Phone" />
<option value="Conatcts" />
<option value="Message" />
</datalist> <strong><abbr title="required">*</abbr></strong>
<input type="submit" value="Submit" />
</center>
<fieldset>
<legend><b>Crawlers for Selected Domain</b>
</legend>
<div id="list_container"></div>
</fieldset>
<fieldset>
<legend><b>Websites for Selected Domain</b>
</legend>
<div id="table_container"></div>
</fieldset>
</form>
</body>
</html>
CSS
<style> h1 {
margin-top: 0;
}
form {
margin: 0 auto;
width : auto;
padding: 1em;
border : 3px solid #CC8;
border-radius: 1em;
}
label {
display:inline-block;
width:auto;
text-align:left;
padding:1em;
}
input {
display:inline-block;
width:200px;
text-align:left;
}
fieldset {
width: auto;
-moz-box-sizing: border-box;
box-sizing: border-box;
margin : 0;
border: 1px solid #999;
}
body {
background: #fafafa;
color: #444;
font: 100%/30px'Helvetica Neue', helvetica, arial, sans-serif;
text-shadow: 0 1px 0 #fff;
}
strong {
font-weight: bold;
}
em {
font-style: italic;
}
table {
background: #f5f5f5;
border-collapse: separate;
box-shadow: inset 0 1px 0 #fff;
font-size: 12px;
line-height: 20px;
margin: 30px auto;
text-align: left;
width: 800px;
}
th {
background: linear-gradient(#777, #444);
border-left: 1px solid #555;
border-right: 1px solid #777;
border-top: 1px solid #555;
border-bottom: 1px solid #333;
box-shadow: inset 0 1px 0 #999;
color: #fff;
font-weight: bold;
padding: 10px 15px;
position: relative;
text-shadow: 0 1px 0 #000;
text-align: right;
}
td {
padding: 0.25rem;
text-align: left;
border: 1px solid #ccc;
}
tbody tr:hover {
background: #C0C0C0;
}
ul {
margin : 15px;
padding: 0;
list-style: square;
}
button {
margin-left: 200px;
}
</style>
JavaScript
function myFunction() {
document.getElementById("list_container").innerHTML = "";
var input_domain = document.forms["form1"]["DomainName"].value;
if (input_domain == null || input_domain == "") {
alert("Please enter a valid domain");
return;
}
var container = document.getElementById("list_container");
var ul = document.createElement("ul");
var navLinks = ["crawler3", "crawler4", "crawler5"];
for (var i = 0; i < navLinks.length; i++) {
ul.innerHTML += "<li> " + navLinks[i] + "</li>";
}
document.getElementById("list_container").appendChild(ul);
return false;
}
function createTable() {
document.getElementById("table_container").innerHTML = "";
var input_domain = document.forms["form1"]["DomainName"].value;
if (input_domain == null || input_domain == "") return;
var table = document.createElement("table"),
tablehead = document.createElement("thead"),
theadrow = document.createElement("tr"),
th1 = document.createElement("th"),
th2 = document.createElement("th"),
th3 = document.createElement("th"),
th4 = document.createElement("th");
th1.appendChild(document.createTextNode("Website"));
th2.appendChild(document.createTextNode("Enable/Disable Live Update for LM and CBD"));
th3.appendChild(document.createTextNode("From Date"));
th4.appendChild(document.createTextNode("To Date"));
theadrow.appendChild(th1);
theadrow.appendChild(th2);
theadrow.appendChild(th3);
theadrow.appendChild(th4);
tablehead.appendChild(theadrow);
table.appendChild(tablehead);
var names = ["website1", "website2"];
var container = document.getElementById("table_container");
var tablebody = document.createElement("tbody");
for (var i = 0, len = names.length; i < len; ++i) {
var row = document.createElement("tr"),
column1 = document.createElement("td"),
column2 =...