当前位置:网站首页>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.效果

边栏推荐
- 空洞卷积、可变形卷积、可变形ROI Pooling
- BUU-Crypto-[GUET-CTF2019]BabyRSA
- left_and_right_net正常版本
- Notepad++ -- display related configurations
- PostgreSQL has officially surpassed mysql. Is this guy too strong!
- Viewing and using binary log of MySQL
- LM小型可编程控制器软件(基于CoDeSys)笔记二十二:错误4268/4052
- TCP状态转换图
- Analysis of classical pointer and array written test questions in C language
- [QT] create mycombobox click event
猜你喜欢

Penetration tool - sqlmap

补某视频网站的js,进行视频解密

Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..

LM小型可编程控制器软件(基于CoDeSys)笔记二十一:错误3703

BUU-Reverse-easyre
![BUU-Crypto-[GUET-CTF2019]BabyRSA](/img/87/157066155e8d3a93e30a68eaf1781b.jpg)
BUU-Crypto-[GUET-CTF2019]BabyRSA

KMP match string

云原生架构实战案例及优化解决方案

Supplement the JS of a video website to decrypt the video

2022年R2移动式压力容器充装复训题库及答案
随机推荐
VB.net GIF(制作、拆解——优化代码,类库——5)
[matlab] matlab simulation modulation system SSB system
Introduction to AMBA
[untitled]
光模块字母含义及参数简称大全
VB.net 调用FFmpeg简单处理视频(类库——6)
[paper summary] zero shot semantic segmentation
C # character similarity comparison general class
[matlab] general function of communication signal modulation bandpass filter
724. 寻找数组的中心下标
总线的基本概念
VB. Net calls ffmpeg to simply process video (class Library-6)
With the advent of the IP era, how can E-sports hotels take advantage of the "east wind" of games?
[matlab] matlab simulation - narrow band Gaussian white noise
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
fastjson
VB. Net simple processing pictures, black and white (class library - 7)
tutle时钟改进版
BUU-Crypto-Cipher
Zhongke panyun-2022 Guangdong Trojan horse information acquisition and analysis