336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
<html>
<head>
<title></title>
<script type="text/javascript">
function fnCopy(objId) {
var imgObj = document.getElementById('imgId');
imgObj.contentEditable = 'true';
var controlRange;
if (document.body.createControlRange) {
controlRange = document.body.createControlRange();
controlRange.addElement(imgObj);
controlRange.execCommand('Copy');
alert("Copy image done");
}
imgObj.contentEditable = 'false';
}
</script>
</head>
<body>
<div id="test1">
<img id="imgId" src="http://www.google.com/intl/en_ALL/images/logo.gif" />
</div>
<a href="javascript:fnCopy('test1');">Copy Image</a>
</body>
</html>
- contentEditable : Controls whether the element is editable by the user via the IE for Windows live content-editing facilities.
- execCommand : Executes a command on the current document, current selection, or the given range.
- createControlRange : Creates a selection range object for control-based selection rather than text-based selection. This returns a pointer to the element created.
I don't think it's a stardard, but it's pretty useful~~~~~
'Programming > Javascript' 카테고리의 다른 글
Node.js, Connect에서 Router?? 이넘 어디 갔나?? (0) | 2013.01.23 |
---|---|
Node.js 책 구입~~ (0) | 2013.01.18 |
이전 포스트 다시보기 1탄 - JSON validator (0) | 2012.11.13 |
소스코드 or 이미지 주소 복사하기 (0) | 2009.06.18 |
JSON Validator (0) | 2009.02.13 |