<header>
<h2 class="title">escape()</h2>
<p class="description">Кодує набір символів у рядок у вигляді %XX або %uXXXX.</p>
</header>
<main>
<div class="result">
<label for="inputText">Введіть рядок для кодування:</label>
<input type="text" id="inputText" placeholder="Привіт, як ти?" />
<button onclick="showEscaped()">Кодувати</button>
<p>Результат: <span id="outputText"></span></p>
</div>
</main>
body {
font-size: 16px;
line-height: 1.5;
font-family: monospace;
}
header {
background-color: #f1f1f1;
margin-bottom: 25px;
padding: 15px;
box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
}
header h2.title {
padding-bottom: 15px;
border-bottom: 1px solid #999;
}
header p.description {
font-style: italic;
color: #222;
}
.result {
background-color: #f8f8f8;
padding: 15px;
box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
box-shadow: 0px 0px 3px 0px rgba(118, 118, 118, 1);
}
input {
padding: 10px;
margin-bottom: 10px;
}
button {
padding: 10px 15px;
background-color: #007BFF;
color: white;
border: none;
cursor: pointer;
transition: 0.3s;
}
button:hover {
background-color: #0056b3;
}
function showEscaped() {
const inputText = document.getElementById('inputText').value;
const outputText = escape(inputText);
document.getElementById('outputText').innerText = outputText;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.