사이트 내 전체검색
[javascript] 네이버처럼 내용복사시 출처 자동넣기
로빈아빠
https://cmd.kr/javascript/574 URL이 복사되었습니다.

본문

<script>
    function contents_cp()
    {
        if (window.event)
        {
            window.event.returnValue = true;
            window.setTimeout('attach_kinref()', 25);
        }
    }
    function attach_kinref()
    {
        if (window.clipboardData) // IE
        {
            // get data from clipboard
            var txt = window.clipboardData.getData('Text');

            // attach the source at the end of text
            txt = txt + '\r\n(출처 : \''+title_js_var+'\' - http://www.virhac.com)\r\n';

            // set data to clibboard
            var result = window.clipboardData.setData('Text', txt);
        }
    }

</script>
<script> var title_js_var = "네이버처럼 복사시 출처밝히기"; </script>

<div id='contents_area' onCopy='javascript:contents_cp();'>
    <p>태그인넷 <a href=http://www.virhac.com>www.virhac.cocm<a> </p>
    내용을 복사해서 붙여넣기하면 자동으로 맨 아래 출처가 입력됩니다..
    복사해서 메모장 같은데 붙여넣기 해보세요.
</div>

댓글목록

등록된 댓글이 없습니다.

831 (1/17P)

Search

Copyright © Cmd 명령어 3.149.243.106