好像不行吧 只能图片的url吧
解决方案 »
- 菜鸟求是思路
- js事件问题?
- 我认为javascript不可能做到的事情。。
- 问题
- 求助求助!如何在html里用javascript输入一个数值输出相应文本?
- 在javascrip里调用vbscrip弹出msgbox如何去掉标题的vbscrip
- 一个简单问题,帮忙,在线等待,立即给分!!!!
- 有办法得到一个对象的属性列表吗?比如<tr width='95%' height='20' ...>中width,height...
- 小白求问Switch语句问题,顺便问一下如何得分,分数快没了。
- 百度编辑器在jqueryeasyui里的问题
- 如何改变IFRAME显示出来之前,该区域的背景色。
- firefox不支持sessionStorage?
<script type="text/javascript">
//<![CDATA[
function copyEventHandler() {
var x=document;
var r=x.selection.createRange();
x.execCommand("Copy");
}
//]]>
</script>
选中图片,点COPY
<input onclick="copyEventHandler()" type="button" value="COPY"/>
<img src="http://zi.csdn.net/760-90netbeans-video_2.gif"/>
</body>
<body id="www.never-online.net">
<script type="text/javascript">
//<![CDATA[
onload = function () {
var x;
x=document.getElementById("p").contentWindow.document
x.open();
x.write("<body contentEditable=true>");
x.close();
window.clipboardData.clearData();
}
function copyEventHandler() {
var x=document;
var r=x.selection.createRange();
x.execCommand("Copy");
x=document.getElementById("p").contentWindow.document;
x.selection.createRange();x.body.focus();
x.execCommand("Paste");
}
//]]>
</script> <img src="http://zi.csdn.net/760-90netbeans-video_2.gif"/><br/>
选中图片,点COPY<br/>
<input onclick="copyEventHandler()" type="button" value="COPY"/> 下面的iframe是Paste后的效果<br/>
<iframe id="p"></iframe>
</body>
我需要达到的是复制图片,然后可以把图片粘贴到画图工具里面去的
html:<img src="xxxxx/null.gif" width="0" height="0" id="10008">
<div class="padding5"><input type="button" class="ctrlc" value="复制到QQ" alt="10008"></div>
js: var $copy = document.body.createControlRange();
$(".ctrlc").click(function(){
//var $img = new Image();
var $id = $(this).attr("alt");
var $src = $(".picture").attr("src");
$("#" + $id).attr("src",$src); var $this = document.getElementById($(this).attr("alt")); if ($this.tagName != 'IMG')
return; if (typeof $this.contentEditable == "undefined")
return; if (!document.body.createControlRange)
return; $this.contentEditable = true;
$copy.addElement($this);
$copy.execCommand("Copy");
$this.contentEditable = false;
alert("复制完成,请在QQ聊天对话框里按Ctrl+V(或点右键后在出现的菜单中点粘贴)然后发图!");});