유용한 도구

글자수 계산기

작성자 정보

  • 차트분석 작성
  • 작성일

컨텐츠 정보

본문

<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>공백 포함 글자수 계산기</title>

    <!-- Bootstrap 5 -->
    <link href="bootstrap@5.3.0/dist/css/bootstrap.min.css"" TARGET="_blank" rel="nofollow">https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"" TARGET="_blank" rel="nofollow">https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>

    <style>
        body {
            background-color: #f8f9fa;
            padding: 30px;
        }
        .container {
            max-width: 700px;
            background: white;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            text-align: center;
        }
        textarea {
            width: 100%;
            height: 150px;
            padding: 10px;
            font-size: 16px;
            border: 1px solid #ccc;
            border-radius: 5px;
            resize: none;
        }
        .stats {
            background: #eef7ff;
            padding: 15px;
            border-radius: 5px;
            margin-top: 10px;
            font-size: 1.2rem;
        }
    </style>
</head>
<body>

    <div class="container">
        <h2 class="mb-3">공백 포함 글자수 계산기</h2>
        <p class="text-muted">입력한 텍스트의 글자 수(공백 포함)를 실시간으로 계산합니다.</p>

        <textarea id="textInput" class="form-control mb-3" placeholder="여기에 텍스트를 입력하세요..." oninput="calculateTextStats()"></textarea>

        <div class="stats">
            <p>글자 수 (공백 포함): <strong id="charCount">0</strong></p>
        </div>

        <button class="btn btn-success w-100 mt-2" onclick="copyToClipboard()"> 클립보드 복사</button>
        <button class="btn btn-secondary w-100 mt-2" onclick="downloadTextFile()"> 텍스트 다운로드</button>
    </div>

    <script>
        function calculateTextStats() {
            const text = document.getElementById("textInput").value;
            const charCount = text.length; // 공백 포함한 글자 수

            document.getElementById("charCount").innerText = charCount;
        }

        function copyToClipboard() {
            const text = document.getElementById("textInput").value;
            if (text === "") {
                alert("복사할 텍스트가 없습니다.");
                return;
            }

            navigator.clipboard.writeText(text)
                .then(() => alert("텍스트가 클립보드에 복사되었습니다!"))
                .catch(() => alert("복사 실패! 수동으로 복사해주세요."));
        }

        function downloadTextFile() {
            const text = document.getElementById("textInput").value;

            if (text === "") {
                alert("저장할 텍스트가 없습니다.");
                return;
            }

            const blob = new Blob([text], { type: "text/plain" });
            const a = document.createElement("a");
            a.href = URL.createObjectURL(blob);
            a.download = "text_data.txt";
            document.body.appendChild(a);
            a.click();
            document.body.removeChild(a);
        }
    </script>

</body>
</html>
공백 포함 글자수 계산기

공백 포함 글자수 계산기

입력한 텍스트의 글자 수(공백 포함)를 실시간으로 계산합니다.

글자 수 (공백 포함): 0

관련자료

📊 크립토 공포지수 Latest Crypto Fear & Greed Index
알림 0