initial
This commit is contained in:
commit
37b7eb3818
6 changed files with 348 additions and 0 deletions
44
php/script.js
Normal file
44
php/script.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
|
||||
function interaktiv(){
|
||||
const zl = document.getElementById('zeichen');
|
||||
const tf = document.getElementById('texta');
|
||||
const sl = document.getElementById('sekunden');
|
||||
const bs = document.getElementById('bsenden');
|
||||
|
||||
|
||||
|
||||
var upd = (target) =>{
|
||||
const maxLength = target.getAttribute("maxlength");
|
||||
const currentLength = target.value.length;
|
||||
zl.innerText = `Zeichen: ${currentLength}/${maxLength} `;
|
||||
if (currentLength >= maxLength) {
|
||||
zl.innerText += " (länger geht nicht!)";
|
||||
return; // console.log("You have reached the maximum number of characters.");
|
||||
}
|
||||
}
|
||||
|
||||
tf.addEventListener("input", (event) => {
|
||||
const target = event.currentTarget;
|
||||
upd(target);
|
||||
|
||||
// tf.ononkeyup = function(ev){
|
||||
// zl.innerText = "Zeichen: "+ tf.textContent.length;
|
||||
// }
|
||||
});
|
||||
|
||||
setInterval( event=>{
|
||||
var diff = (window.letztesMal + 5000) - Date.now();
|
||||
var sek = Math.floor(diff / 1000);
|
||||
if(sek == 0) {
|
||||
bs.disabled = false;
|
||||
}
|
||||
if(sek < 0)
|
||||
return;
|
||||
sl.innerText = "Sekunden bis zum nächsten Senden: " + sek;
|
||||
}, 100);
|
||||
|
||||
upd(tf);
|
||||
}
|
||||
|
||||
|
||||
document.onload = interaktiv().bind(this);
|
Loading…
Add table
Add a link
Reference in a new issue