메뉴 건너뛰기

tnt_lang

<html>
<head>
<title>textarea의 내용을 클립보드에 담아 처리하기 </title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script language="javascript">

        // 클립보드에 있는 값
        var cbData = "";

        function view_tag()
        {
                // 값 읽어내기
                cbData = window.clipboardData.getData('Text');
                alert(cbData);
        }

        function select_tag()
        {
                document.theForm.theArea.select();
        }

        function copy_tag()
        {
                document.theForm.theArea.select();
                window.clipboardData.setData('Text', document.theForm.theArea.value);
                var bSuccess = window.clipboardData.setData('Text', document.form_tag.tag.value);
                document.execCommand('Copy');

                if (bSuccess) alert('성공적으로 본문의 내용이 클립보드로 복사되었습니다.');
                else alert('본문의 내용을 클립보드로 복사하는데 실패했습니다.');

                document.execCommand('Copy');
        }
</script>
</head>

<body bgcolor="#FFFFFF">
<div id="Layer1" align="center">
  <form name="theForm">
    <textarea name="theArea" cols="40" rows="20">
            이것이 복사될문자열이다........
                ....

        다음은 영문..
        text to be copied
        
        </textarea>
  </form>
</div>

<div align=center>
        <input type=button value="태그선택" onclick="select_tag()">
        <input type=button value="태그선택복사" onclick="copy_tag()">
        <input type=button value="클립보드보기" onclick="view_tag()">
        <input type=button value="창닫기" onclick="window.close()">
</div>
</body>
</html>
위로