当前位置:网站首页>Upload file / text / picture, box shadow
Upload file / text / picture, box shadow
2022-06-26 03:22:00 【Small vegetable bird yard live】
Upload files
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
div{
width: 200px;
height: 200px;
border: 1px solid black;
box-shadow: 3px 3px 3px 3px;
font-size: 30px;
margin: 0 auto;
}
</style>
</head>
<body>
<div> Hello </div>
<input id="file" multiple type="file">
<button id="btn"> Upload files </button>
<ul id="msg">
<li></li>
<li></li>
</ul>
</body>
<script>
// var file = document.querySelector('#file');
var file = document.getElementById('file');
var btn = document.getElementById('btn');
var msg = document.getElementById('msg');
btn.onclick = function(){
var reader = new FileReader();
reader.readAsText(file.files[0]);
// reader.readAsDataURL(file.files[0]);
reader.onload = function(){
console.log(this.result)
// msg.children[0].innerHTML = '<img src=''>'
}
// msg.children[0].innerHTML = file.files[0].name;
// console.log(file.files);
// for(var i=0;i<file.files.length;i++){
// if(!/image/.test(file.files[i].type)){
// if(file.files[i].type.indexOf('image')===-1){
// alert(' The file format is not correct ');
// return;
// }
// }
// alert(' Upload successful ');
}
// asynchronous
// Sync
console.log(1);
console.log(2);
alert(3);
setTimeout(function(){
console.log(4);
},3000)
console.log(5);
</script>
</html>
边栏推荐
- 【QT】自定义控件-空气质量仪表盘
- Google recommends using kotlin flow in MVVM architecture
- js array数组json去重
- What can Arthas do for you?
- Use annotationdbi to convert gene names in R
- P2483-[template]k short circuit /[sdoi2010] Magic pig college [chairman tree, pile]
- 使用IDEA画结构图
- Interpreting Oracle
- Drawing structure diagram with idea
- 双碳红利+基建大年 | 图扑深耕水利水电绿色智能装备领域
猜你喜欢
Analysis of the multiple evaluation system of children's programming
【读点论文】FBNetV3: Joint Architecture-Recipe Search using Predictor Pretraining 网络结构和超参数全当训练参数给训练了
How Inkscape converts PNG pictures to SVG pictures without distortion
UE5全局光照系统Lumen解析与优化
Oracle connectivity issues and Solutions
What can Arthas do for you?
Group note data representation and operation check code
Group counting notes - instruction pipeline of CPU
浅谈虚拟内存与项目开发中的OOM问题
ArrayList#subList这四个坑,一不小心就中招
随机推荐
Distributed e-commerce project grain mall learning notes < 3 >
Group note data representation and operation check code
Analysis and optimization of ue5 global illumination system lumen
Stm32cubemx: watchdog ------ independent watchdog and window watchdog
多媒体元素,音频、视频
拖放
What can Arthas do for you?
UE5全局光照系統Lumen解析與優化
Where is it safe to open a fund account?
Is it safe for Caicai securities to open an account in 2022?
进度条
《你不可不知的人性》经典语录
The role of children's programming in promoting traditional disciplines in China
Do you want to add a key to the applet or for sequence?
在哪里开基金帐户安全?
Wealth freedom skills: commercialize yourself
Use annotationdbi to convert gene names in R
P2483-[template]k short circuit /[sdoi2010] Magic pig college [chairman tree, pile]
HL7Exception: Can‘t XML-encode a GenericMessage. Message must have a recognized struct
How Inkscape converts PNG pictures to SVG pictures without distortion