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

边栏推荐
- 2022年T电梯修理操作证考试题库及模拟考试
- Zhongke Panyun - data analysis and forensics packet flag
- [matlab] communication signal modulation general function interpolation function
- VB.net 简单的处理图片,黑白(类库——7)
- 光模塊字母含義及參數簡稱大全
- 19. Framebuffer application programming
- Thread pool: use thread pool to optimize query speed
- [matlab] matlab simulation modulation system - DSB system
- [high concurrency, high performance and high availability of massive data MySQL practice-7] - memory data drop disk
- Letter meaning and parameter abbreviation of optical module Daquan
猜你喜欢

2022 R2 mobile pressure vessel filling retraining question bank and answers

空洞卷积、可变形卷积、可变形ROI Pooling

Trie number dictionary tree

724. Find the central subscript of the array

ETCD数据库源码分析——初始化总览

Zhongke panyun-2022 Guangdong Trojan horse information acquisition and analysis

Write a complete answer applet (including single choice questions, judgment questions and multiple topics) (III) single choice questions, judgment questions, and the first question display
![[paper summary] zero shot semantic segmentation](/img/78/ee64118d86a7e43ec4d1cb97191fbe.jpg)
[paper summary] zero shot semantic segmentation

【雕爷学编程】Arduino动手做(105)---压电陶瓷振动模块

2022G2电站锅炉司炉特种作业证考试题库及答案
随机推荐
[matlab] general function of communication signal modulation bandpass filter
LM small programmable controller software (based on CoDeSys) note XXI: error 3703
2022 R2 mobile pressure vessel filling retraining question bank and answers
2022年T电梯修理操作证考试题库及模拟考试
[untitled]
【兴趣阅读】Adversarial Filtering Modeling on Long-term User Behavior Sequences for Click-Through Rate Pre
[matlab] matlab simulation modulation system FM system
Introduction to AMBA
What are the reasons for the frequent high CPU of ECS?
Flutter ‘/usr/lib/libswiftCore. dylib‘ (no such file)
VB.net 简单的处理图片,黑白(类库——7)
Li Kou's 300th weekly match
光模块字母含义及参数简称大全
Just do it with your hands 7 - * project construction details 2 - hook configuration
Flask
Principle and practice of common defects in RSA encryption application
2022G2电站锅炉司炉特种作业证考试题库及答案
VB. Net GIF (making and disassembling - optimizing code, class library - 5)
Unity is connected to the weather system
十二. golang其他