如何将图像从剪贴板粘贴到网页中? [英] How to paste an image into web page from clipboard?

查看:82
本文介绍了如何将图像从剪贴板粘贴到网页中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


就像我们需要从台式机或硬盘中的某个位置复制图像并将其粘贴到网页中一样.而不是单击浏览按钮并选择图像.

请提出

谢谢.

Hi All,


Requirement like we need to copy the image from desktop or somewhere in the hard disk and paste into the web page. instead of clicking browse button and select the image.

Please suggest

Thanks.

推荐答案

如果没有ActiveX(IE)或非IE浏览器的适当插件的帮助,我会说,使用标准HTML和javascript是不可能的.

谢谢!
Without the help of an activeX (IE) or an appropriate plugin for non-IE browser I''d say this is impossible with standard HTML and javascript.

Cheers!


先生,您可以处理输入的粘贴事件:

Sir, you can just handel the on paste event of an input:

<script type="text/javascript" >
function DoCopy(imgsrc){
window.clipboardData.setData('URL',imgsrc);
//...
}
function DoPaste(targetimg){
var imgsrc = new String( window.clipboardData.getData('URL'));
targetimg.src = imgsrc;
//do your code
}
</script>
<img onpaste ="DoPaste(this.src);" />
<img oncut ="DoCut(this.src);" />




100:rose:;)




100 :rose: ;)


请提出使用activeX(IE)的方法
Please suggest way to proceed using activeX(IE)


这篇关于如何将图像从剪贴板粘贴到网页中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆