-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #801 from AshokKumar7070/patch-6
Create qrcode.html
- Loading branch information
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>QR Code Generator</title> | ||
<style> | ||
body { | ||
font-family: Arial, sans-serif; | ||
text-align: center; | ||
padding: 50px; | ||
} | ||
#qrcode { | ||
margin-top: 20px; | ||
} | ||
input[type="text"] { | ||
width: 80%; | ||
padding: 10px; | ||
font-size: 16px; | ||
} | ||
button { | ||
padding: 10px 20px; | ||
font-size: 16px; | ||
margin-top: 20px; | ||
cursor: pointer; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1>QR Code Generator</h1> | ||
<input type="text" id="textInput" placeholder="Enter text or URL" /> | ||
<br/> | ||
<button onclick="generateQRCode()">Generate QR Code</button> | ||
<div id="qrcode"></div> | ||
|
||
<!-- Include the QRCode.js library --> | ||
<script src="https://cdn.jsdelivr.net/npm/qrcodejs/qrcode.min.js"></script> | ||
|
||
<script> | ||
// Function to generate the QR code | ||
function generateQRCode() { | ||
// Get the input value | ||
const text = document.getElementById('textInput').value; | ||
|
||
// Clear any previous QR codes | ||
document.getElementById('qrcode').innerHTML = ''; | ||
|
||
// Generate a new QR code | ||
if (text) { | ||
new QRCode(document.getElementById('qrcode'), text); | ||
} else { | ||
alert("Please enter some text or URL!"); | ||
} | ||
} | ||
</script> | ||
</body> | ||
</html> |