当前位置:网站首页>Input displays the currently selected picture
Input displays the currently selected picture
2022-07-04 05:37:00 【A bowl of noodles from the landlady】
1.jsp Code
<div class="lf salebd">
<a href="#">
<img src="images/ad20.jpg" id="img" width="100" height="100"/></a></div>
2.js Code
$(function () {
$("#file").change(function () {
if (this.files.length) {
let file = this.files[0];
let reader = new FileReader();
// newly build FileReader object
reader.onload = function () {
// When FileReader When reading a file , The read results will be placed in FileReader.result Properties of the
document.querySelector('#img').src = this.result;
document.querySelector('#text').innerHTML = this.result;
};
// Set how to read files , Here we use base64 The way
reader.readAsDataURL(file);
}
})
})
3. effect
边栏推荐
- BUU-Pwn-test_ your_ nc
- [paper summary] zero shot semantic segmentation
- BUU-Reverse-easyre
- Graduation design of small programs -- small programs of food and recipes
- Google Chrome browser will support the function of selecting text translation
- [high concurrency, high performance and high availability of massive data MySQL practice-7] - memory data drop disk
- 19. Framebuffer application programming
- Flask
- Etcd database source code analysis - initialization overview
- VB.net 调用FFmpeg简单处理视频(类库——6)
猜你喜欢
2022 question bank and answers for safety management personnel of hazardous chemical business units
Simulated small root pile
Build an Internet of things infrared temperature measuring punch in machine with esp32 / rush to work after the Spring Festival? Baa, no matter how hard you work, you must take your temperature first
C语言简易学生管理系统(含源码)
Actual cases and optimization solutions of cloud native architecture
Programming example of stm32f1 and stm32subeide -74hc595 drives 4-bit 7-segment nixie tube
云原生架构实战案例及优化解决方案
Evolution of system architecture: differences and connections between SOA and microservice architecture
如何使用postman实现简单的接口关联【增删改查】
Introduction To AMBA 简单理解
随机推荐
VB.net 简单的处理图片,黑白(类库——7)
2022 a special equipment related management (elevator) examination questions simulation examination platform operation
Risc-v-qemu-virt in FreeRTOS_ Lock mechanism analysis of GCC
基于单片机的太阳能杀虫系统
Talk about the SQL server version of DTM sub transaction barrier function
IP时代来临,电竞酒店如何借好游戏的“东风”?
【QT】制作MyComboBox点击事件
简易零钱通
[技术发展-25]:广播电视网、互联网、电信网、电网四网融合技术
c语言经典指针和数组笔试题解析
Google Chrome browser will support the function of selecting text translation
Flink1.13 SQL basic syntax (I) DDL, DML
Canoe panel learning video
1.1 history of Statistics
BUU-Crypto-Cipher
空洞卷积、可变形卷积、可变形ROI Pooling
What is MQ?
[matlab] general function of communication signal modulation inverse Fourier transform
Daily question brushing record (12)
Trie数-字典树