You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
601 B
21 lines
601 B
function generujQR(){
|
|
const input = document.getElementById("qrText")
|
|
const image = document.getElementById("qrImg")
|
|
const text = input.value.trim()
|
|
|
|
if(text==""){
|
|
alert("Nejdříve musíš něco napsat!");
|
|
return;
|
|
}
|
|
|
|
const apiUrl = `https://api.qrserver.com/v1/create-qr-code/?size=250x250&data=${encodeURIComponent(text)}`
|
|
|
|
image.src = apiUrl;
|
|
image.style.display = "inline-block";
|
|
console.log("Generuji QR pro:",text)
|
|
}
|
|
document.getElementById("qrText").addEventListener("click", (e)=> {
|
|
if (e.key === "Enter") {
|
|
generujQR();
|
|
}
|
|
})
|