89 lines
2.3 KiB
HTML
89 lines
2.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang ="en">
|
|
<head>
|
|
|
|
|
|
<style>
|
|
body {
|
|
background-color: #2B2A34;
|
|
}
|
|
.input_field {
|
|
display: flex;
|
|
justify-content: center;
|
|
}
|
|
.response_container {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
max-width: fit-content;
|
|
margin: 5px auto;
|
|
|
|
}
|
|
.response_text {
|
|
display: flex;
|
|
justify-content: center;
|
|
border: 2px solid black;
|
|
border-radius: 5px;
|
|
max-width: 300px;
|
|
margin: 5px auto;
|
|
background-color: white;
|
|
width: 200px;
|
|
height: 20px;
|
|
}
|
|
.response_button {
|
|
display: flex;
|
|
justify-content: center;
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
function convert_input() {
|
|
const input = document.getElementById('input').value;
|
|
const converted_input = input.replace(/ /g, "");
|
|
|
|
|
|
const box = document.getElementById('response_text');
|
|
box.textContent = converted_input;
|
|
document.getElementById('input').value = '';
|
|
|
|
}
|
|
</script>
|
|
|
|
|
|
<meta charset="UTF-8">
|
|
<meta name="viewpoint" content="width=device-width, initial-scale=1.0">
|
|
<title>javascript test</title>
|
|
</head>
|
|
<body>
|
|
<div class="input_field">
|
|
<input type="text" id="input"/>
|
|
<button onclick = "convert_input()"> send </button>
|
|
<script>
|
|
const input = document.getElementById('input');
|
|
input.addEventListener('keydown', function(event) {
|
|
if (event.keyCode === 13){
|
|
convert_input();
|
|
}
|
|
})
|
|
</script>
|
|
</div>
|
|
<div id="response_container" class="response_container">
|
|
<div id="response_text" class="response_text"></div>
|
|
<div class="response_button">
|
|
<button onclick="copy_to_clipboard()">📋</button>
|
|
</div>
|
|
<script>
|
|
function copy_to_clipboard() {
|
|
const copyText = document.getElementById('response_text').textContent;
|
|
console.log(copyText);
|
|
|
|
navigator.clipboard.writeText(copyText);
|
|
}
|
|
</script>
|
|
</div>
|
|
</body>
|
|
</html> |