当前位置:网站首页>JS to read the picture of the clipboard
JS to read the picture of the clipboard
2022-06-23 00:45:00 【Ziwei front end】
<script>
function test(evt){
//for chrome
var clipboardData = evt.clipboardData;
for(var i=0; i<clipboardData.items.length; i++){
var item = clipboardData.items[i];
if(item.kind=='file'&&item.type.match(/^image\//i)){
//blob Is the binary image data in the clipboard
var blob = item.getAsFile(),reader = new FileReader();
// Definition fileReader Callback after reading data
reader.onload=function(){
var sHtml='<img src="'+event.target.result+'">';//result Should be base64 Encoded picture
document.getElementById('dd').innerHTML += sHtml;
}
reader.readAsDataURL(blob);// use fileReader Read binary picture , The callback function defined above will be called after completion
}
}
}
</script>
<textarea id="t" onpaste="test(event)" cols=60 rows=5></textarea>
<div id="dd"></div>边栏推荐
- 工程目录导航
- How about precious metal spot silver?
- Dual cross domain: access allow origin header contains multiple values "*, *", but only one is allowed
- Introduction to the unique variable reading and writing function of Kunlun distributed database
- Software construction course ADT and OOP understanding
- #yyds干货盘点#尾递归比递归好在哪儿
- Is Ruida futures safe? What are the procedures for opening futures accounts? How to reduce the futures commission?
- flowable 全局监听 监听流程的启动和流程的结束
- SAP mm me27 create intra company sto order
- 【滑动窗口】leetcode992. Subarrays with K Different Integers
猜你喜欢

SAP ui5 application development tutorial 102 - detailed explanation of the print function of SAP ui5 applications

Dig three feet to solve the data consistency problem between redis and MySQL

Have you stepped on these pits? Use caution when creating indexes on time type columns

層次選擇器

SAP UI5 应用开发教程之一百零三 - 如何在 SAP UI5 应用中消费第三方库试读版

SAP mm transaction code vl04 create outbound delivery for sto

【机器学习-西瓜书】更文挑战【Day1】:1.1 引言

二叉树转字符串及字符串转二叉树

OSPF comprehensive experiment

Analysis on the wallet system architecture of Baidu trading platform
随机推荐
Database daily question - day 20: selling products by date
二叉树转字符串及字符串转二叉树
“听觉”营销价值凸显,喜马拉雅迎来新局点
LeetCode刷题——715. Range 模块
Cadence spb17.4 - Chinese UI settings
TIDB监控升级解决panic的漫漫探索之路
BGP联邦综合实验
MGRE环境下的OSPF实验
SAP MM 事务代码VL04为STO创建外向交货单
Typecho imite le modèle de thème du blog Lu songsongsong / modèle de thème du blog d'information technologique
cadence SPB17.4 - allegro - 優化指定單條電氣線折線連接角度 - 折線轉圓弧
SAP ui5 application development tutorial 103 - how to consume the trial version of the third-party library in SAP ui5 applications
Is it safe to invest in funds through daily funds? I intend to open an account to buy funds
Dual cross domain: access allow origin header contains multiple values "*, *", but only one is allowed
How to set the power-off auto start of easycvr hardware box
[launch] redis Series 2: data persistence to improve availability
Analysis on the wallet system architecture of Baidu trading platform
Ansible learning summary (7) -- ansible state management related knowledge summary
How to get started with machine learning?
Quelle est la structure et la façon dont les données sont stockées dans la base de données?