当前位置:网站首页>input显示当前选择的图片
input显示当前选择的图片
2022-07-04 05:16:00 【老板娘来碗面】
1.jsp代码
<div class="lf salebd">
<a href="#">
<img src="images/ad20.jpg" id="img" width="100" height="100"/></a></div>2.js代码
$(function () {
$("#file").change(function () {
if (this.files.length) {
let file = this.files[0];
let reader = new FileReader();
//新建 FileReader 对象
reader.onload = function () {
// 当 FileReader 读取文件时候,读取的结果会放在 FileReader.result 属性中
document.querySelector('#img').src = this.result;
document.querySelector('#text').innerHTML = this.result;
};
// 设置以什么方式读取文件,这里以base64方式
reader.readAsDataURL(file);
}
})
})3.效果

边栏推荐
- Automated testing selenium foundation -- webdriverapi
- Unity2D--人物移动并转身
- C # character similarity comparison general class
- 总线的基本概念
- [untitled]
- BUU-Pwn-test_ your_ nc
- Zhongke Panyun - data analysis and forensics packet flag
- Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..
- Principle and practice of common defects in RSA encryption application
- Topological sorting and graphical display of critical path
猜你喜欢

VB.net 简单的处理图片,黑白(类库——7)

Halcon图片标定,使得后续图片处理过后变成与模板图片一样

June 2022 summary

2022危险化学品经营单位安全管理人员上岗证题库及答案

【兴趣阅读】Adversarial Filtering Modeling on Long-term User Behavior Sequences for Click-Through Rate Pre

Automated testing selenium foundation -- webdriverapi

Appearance of LabVIEW error dialog box

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
![[MySQL practice of massive data with high concurrency, high performance and high availability -8] - transaction isolation mechanism of InnoDB](/img/8e/90d08d22a2d340242be2357f662ea4.jpg)
[MySQL practice of massive data with high concurrency, high performance and high availability -8] - transaction isolation mechanism of InnoDB

Simulated small root pile
随机推荐
ETCD数据库源码分析——初始化总览
19. Framebuffer application programming
LM小型可编程控制器软件(基于CoDeSys)笔记二十二:错误4268/4052
Unity2D--人物移动并转身
[paper summary] zero shot semantic segmentation
KMP match string
Supplement the JS of a video website to decrypt the video
Solar insect killing system based on single chip microcomputer
数据标注是一块肥肉,盯上这块肉的不止中国丨曼孚科技
Redis realizes ranking function
TCP状态转换图
c语言经典指针和数组笔试题解析
Risc-v-qemu-virt in FreeRTOS_ Lock mechanism analysis of GCC
2022 a special equipment related management (elevator) examination questions simulation examination platform operation
Simulated small root pile
2022 Guangdong provincial competition - code information acquisition and analysis flag
[matlab] matlab simulation modulation system FM system
Ping port artifact psping
How to use postman to realize simple interface Association [add, delete, modify and query]
Void convolution, deformable convolution, deformable ROI pooling