필요해서 몇가지 뒤적 뒤적 거리다 발견했음 

 <script>
function clip() {
var url=document.url;
window.clipboardData.setData("Text", url);
alert("URL이 클립보드에 복사되었습니다. CTRL+V하시면 URL이 입력됩니다");
}
</script>

<a href="javascript:clip()" onfocus="blur();">url복사</a>



<script>
function copy(URL) {        
        window.clipboardData.setData("Text",URL);
        alert!("주소가 클립보드에 복사되었습니다.");
  return;
}
</script>

사용예 1 
onClick = "javascript:void(copy('http://l2j.co.kr'))"

복사 버튼이미지를 클릭할때.. onClick이벤트를 통해 
copy('복사할 주소') 이런식으로 주소 값을 copy()함수로 넘겨주면 됩니다.

사용예 2

웹페이지의 소스를 모두 복사
onClick = "javascript:void(copy(document.body.innerHTML))"




[clipboardPoter.as]
function setClipBoard(str) {
        System.setClipboard(str);
        flash.external.ExternalInterface.call(callback, true);
}
System.security.allowDomain("*");
var methodName = "setClipBoard";
var instance = null;
var method = setClipBoard;
var wasSuccessful = flash.external.ExternalInterface.addCallback(methodName, instance, method); 


[copy2clipboard.js]
function document_write(s){
    document.write(document.getElementById(s).value);
}
var sUserAgent = navigator.userAgent;
var isOpera = sUserAgent.indexOf("Opera") > -1;
var isIE = sUserAgent.indexOf("compatible") > -1
        && sUserAgent.indexOf("MSIE") > -1
        && !isOpera;
function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
    return document.getElementById(movieName);
    }
    else {
    return document[movieName];
    }
}
function copyUrl(url) {
    try {
        thisMovie('clipboardPoter').setClipBoard(url);
    } catch(e) {
        if(isIE) {
            window.clipboardData.setData('Text',url);
            window.alert("주소가 복사되었습니다.");
        }
    }
}
function onClipBorad(result) {
    alert(result ? "주소가 복사되었습니다." : "주소 복사를 실패했습니다.");
}


[copy2clipboard.html]
<script type='text/javascript'>
window.clipboardPoter = document.getElementById("clipboardPoter");
</script>

<span onclick="copyUrl('http://l2j.co.kr')" style="cursor:pointer">http://l2j.co.kr</span>

<div style="position:absolute;top:0;left:0; background-color:transparent;background-image:none">
<textarea id="flash_copy_to_clipboard" style="display:none;" rows="0" cols="0">
<OBJECT id="clipboardPoter" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="1" height="1"><param name="src" value="/swf/clipboardPoter.swf"/><param name="movie" value="/swf/clipboardPoter.swf"/><param name="wmode" value="transparent"><param name="allowscriptaccess" value="always"><param name="flashvars" value="callback=onClipBorad"><EMBED name="clipboardPoter" pluginspage="http://www.macromedia.com/go/getflashplayer" src="/swf/clipboardPoter.swf" width="1" height="1" type="application/x-shockwave-flash" quality="high" wmode="transparent" FlashVars="callback=onClipBorad" allowscriptaccess="always"></EMBED></OBJECT></textarea><script type='text/javascript'>document_write('flash_copy_to_clipboard');</script>
</div> 

+ Recent posts