-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 #592 from sanjevraj-J/patch-2
QR_Generator
- Loading branch information
Showing
1 changed file
with
86 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,86 @@ | ||
<!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 { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
margin: 0; | ||
background-color: #f7f7f7; | ||
font-family: Arial, sans-serif; | ||
} | ||
|
||
.container { | ||
text-align: center; | ||
background: white; | ||
padding: 20px; | ||
border-radius: 8px; | ||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
h1 { | ||
margin-bottom: 20px; | ||
color: #333; | ||
} | ||
|
||
input { | ||
width: 80%; | ||
padding: 10px; | ||
border: 1px solid #ddd; | ||
border-radius: 5px; | ||
margin-bottom: 10px; | ||
} | ||
|
||
button { | ||
padding: 10px 20px; | ||
border: none; | ||
border-radius: 5px; | ||
background-color: #007bff; | ||
color: white; | ||
cursor: pointer; | ||
transition: background-color 0.3s; | ||
} | ||
|
||
button:hover { | ||
background-color: #0056b3; | ||
} | ||
|
||
#qrcode { | ||
margin-top: 20px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>QR Code Generator</h1> | ||
<input type="text" id="inputText" placeholder="Enter text or URL" /> | ||
<button id="generateButton">Generate QR Code</button> | ||
<div id="qrcode"></div> | ||
</div> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js"></script> | ||
<script> | ||
$(document).ready(function() { | ||
$('#generateButton').on('click', function() { | ||
const inputText = $('#inputText').val(); | ||
$('#qrcode').empty(); // Clear previous QR code | ||
|
||
if (inputText) { | ||
$('#qrcode').qrcode({ | ||
text: inputText, | ||
width: 200, | ||
height: 200 | ||
}); | ||
} else { | ||
alert("Please enter a valid text or URL"); | ||
} | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</html> |