JSFiddle - React, Tailwind, and code Playground
by rasikaceg
HTML
<body>
<form name="form1" method="post" onSubmit="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>
</form>
<form name="form2" action="http://www.cs.tut.fi/cgi-bin/run/~jkorpela/echo.cgi" method="post">
<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>
<input type="submit" value="submit" />
</fieldset>
</form>
</body>
CSS
<style> h1 {
margin-top: 0;
}
form {
background-color:#F5F5F5;
margin: 0 auto;
width : auto;
padding: 1em;
}
label {
font-weight: bold;
display: block;
width: 100px;
float: left;
text-align:left;
color: #0B0B61;
font-family:'Oswald';
font-size: 20px;
text-decoration: none;
}
legend {
font-weight: bold;
display: block;
color: #0B0B61;
font-family:'Oswald';
font-size: 20px;
text-decoration: none;
}
input {
display:inline-block;
width:200px;
text-align:left;
margin:auto;
}
fieldset {
width: auto;
-moz-box-sizing: border-box;
box-sizing: border-box;
margin : 0;
border: 1px solid #0B0B61;
}
p {
font-family:'Oswald';
color: #685F5F;
}
body {
border : 3px solid #0B0B61;
border-radius: 1em;
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;
color: #0B0B61;
}
input[type=submit] {
width:100px;
margin-left: 100px;
background-color: #ccc;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius:6px;
...
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 =...