JSFiddle - React, Tailwind, and code Playground
by Voron
HTML
<!DOCTYPE html>
<html lang=uk>
<head>
<meta charset=utf-8>
<title> Вивчаємо іспанську </title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="/español.com/js/words.js"></script>
</head>
<body>
<audio id="audio" controls="controls" preload="auto">
<source id="sourceogg" src="http://193.238.98.86/spanish.com/files/cama.ogg" type="audio/ogg" />
<source id="sourcemp3" src="http://193.238.98.86/spanish.com/files/cama.mp3" type="audio/mp3" />
Your browser does not support the audio element.
</audio>
<div id="conteiner">
<header id="header">
<ul>
<li><a href="#"><span id="quantity"></span><span> слів</span></a></li>
<li><a href="#" onclick="show_form(); return false;">Додати слово </a></li>
<li><a href="#" onclick="test(); return false;">Тестування </a></li>
<li><a href="#">Календар </a></li>
</ul>
</header>
<div id="newword">
<form action="add_word.php" onsubmit="return false">
<label for="word">Слово</label><br>
<input type="text" name="word" id="word"><br>
<label for="translation">Переклад</label><br>
<input type="text" name="translation" id="translation"><br>
<input type="submit" id="button" onclick="add_word(); return false;" value=" Додати слово ">
<img src="img/keyboard.png" alt="kbd" onclick="show_keyboard()">
</form>
</div>
<div id="keyboard">
<div class="symbol">q</div>
<div class="symbol">w</div>
<div class="symbol">e</div>
<div class="symbol">r</div>
<div class="symbol">t</div>
<div class="symbol">y</div>
<div class="symbol">u</div>
<div class="symbol">i</div>
<div class="symbol">o</div>
<div class="symbol">p</div>
<div class="symbol">`</div>
<div id="a" class="symbol">a</div>
<div...
CSS
/* CSS Document*/
@import url("reset-min.css");
html {
font: 100%/1.5 Tahoma,Verdana,Geneva,Helvetica,Arial,"Lucida Grande",sans-serif;
}
div#conteiner {
position: relative;
width: 700px;
margin-left: auto;
margin-right: auto;
display:block;
}
div#content {
min-height: 800px;
margin-top: 5px;
margin-bottom: 10px;
}
header#header {
clear:both;
height: 30px;
margin-top: 5px;
line-height: 30px;
background-color:rgb(255, 153, 51);
border:2px solid black;
padding: 1%;
border-radius: 10px;
}
header#header>ul>li {
margin-left: auto;
margin-right: auto;
padding: 0px;
margin: 10px;
display: inline;
}
#audio {
visibility: hidden;
position: fixed;
}
#quantity {
font-size: 120%;
color: white;
}
a:visited {
color: #000;
}
div#newword {
display: none;
position: relative;
width: 37.1%;
height: 157px;
border:2px solid black;
padding: 1% 1% 1% 2%;
border-radius: 10px;
margin-top: 5px;
background-color:rgb(255, 153, 51);
}
div#newword > form > img {
position: absolute;
bottom: 20px;
right: 15px;
}
#button {
position: absolute;
bottom: 20px;
right: 55px;
}
div#keyboard {
display: none;
position: absolute;
top: 48px;
right: 0;
width: 55%;
margin: 5px 0 0 5px;
border:2px solid black;
padding: 10px;
border-radius: 10px;
background-color: white;
overflow: hidden;
}
div#keyboard>div {
background-color: white;
border: 1px solid #E3E3E3;
border-radius: 5px;
color: black;
cursor: pointer;
float: left;
margin: 2px;
padding: 10px;
text-align: center;
}
div#a, #z {
clear: left;
}
table {
width: 100%;
border-collapse: collapse;
}
th, td {
width: 25%;
border: 2px solid #000;
padding: 0.3em;
}
td.spanish {
background: #ccc;
cursor: pointer;
}
td.translation {
background:...
JavaScript
form = document.getElementById("newword");
keyboard = document.getElementById("keyboard");
table = document.getElementById("wordtable");
testdiv = document.getElementById("testdiv");
quantity = document.getElementById("quantity");
audio = document.getElementById("audio");
sourceogg = document.getElementById("sourceogg");
sourcemp3 = document.getElementById("sourcemp3");
aspan = document.createElement('span');
aspan.id = "aspan";
aspan.innerHTML = 'word';
audio.addEventListener('ended', function() {
document.body.removeChild(aspan);
}, false);
n = document.getElementById("wordtable").className * 1;
quantity.innerHTML = n;
a = new Array();
var b = new Array();
var object = document.getElementById('keyboard');
for (var childItem in object.childNodes) {
if (object.childNodes[childItem].nodeType == 1)
var id = object.childNodes[childItem].innerHTML;
(function(id) {
object.childNodes[childItem].onclick = function() {
document.getElementById("word").value += id;
document.getElementById("word").focus();
}
})(id);
}
for (var i = 1; i<n/2+0.6; i++) {
var row = document.getElementById("row" + i);
for (var cell in row.childNodes) {
if (row.childNodes[cell].nodeType == 1) {
if (cell % 2 == 0) {
row.childNodes[cell].addEventListener("click", function(){play(this.innerHTML)}, false);
}
if (cell % 4 < 2) {
a.push(row.childNodes[cell].innerHTML);
} else {
b.push(row.childNodes[cell].innerHTML);
}
}
}
}
a = a.concat(b);
function show_form() {
if (form.style.display == "block") {
form.style.display = "none";
keyboard.style.display = "none";
}...