zoukankan
html css js c++ java
上传并查看图片
<!DOCTYPE html> <!-- saved from url=(0034)http://localhost:61694/Image/Index --> <html style="" class=" js flexbox flexboxlegacy canvas canvastext webgl no-touch geolocation postmessage websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers no-applicationcache svg inlinesvg smil svgclippaths"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <pre><code><meta name="viewport" content="width=device-width"> <title></title> <link href="./Index_files/bootstrap.css" rel="stylesheet"> </code></pre> <link href="./Index_files/site.css" rel="stylesheet"> <pre><code><script src="./Index_files/modernizr-2.8.3.js.下载"></script> </code></pre> </head> <body> <style> .must{ color:red; font-size:14px; } .userImg1{ 240px; height:135px; display: inline-block; background-color: #f3f5f4; text-align: center; line-height: 135px; vertical-align: top; margin-top:13px; margin-left:8px; cursor:pointer; } .userImg1{ background-size: 240px 135px; } .sub-btn{ 92px; height:35px; background-color: #e1251a; display: block; margin:25px 0 0 94px; border:none; outline: none; color:#fff; cursor:pointer; } input[type="file"] { display: none; } </style> <pre><code><div> <h1>图片选择</h1> <div class="userImg1" onclick="uploadFile('userImg1')" style="background-image: url("blob:http://localhost:61694/5f866f8a-7399-4b10-9870-74e34a237b49");">+添加图片</div> <input type="file" name="uploadImg1" display="none" class="fileBtn" accept="image/*" onchange="dofileBtn(this)"> </div> </code></pre> <script src="./Index_files/jquery-3.3.1.js.下载"></script> <script type="text/javascript"> var fileBtn = document.getElementsByClassName("fileBtn"); function dofileBtn(e) { const fileObj = e.files[0]; const windowURL = window.URL || window.webkitURL; if (fileBtn && fileObj) { const imgURL = window.URL.createObjectURL(fileObj); $(".userImg1").css("background-image", "url(" + imgURL + ")"); } } function uploadFile(e) { $(".fileBtn").click(); } $(".fileBtn").on("change", dofileBtn); </script> <pre><code></div> </code></pre> </body></html>
查看全文
相关阅读:
JavaScript和DOM
CSS补充以及后台页面布局
HTML标签和CSS基础
基于SQLAlchemy实现的堡垒机
PymySQL
SQLAlchemy
负数取模
list
算法(3)
python初识(3)
原文地址:https://www.cnblogs.com/yyl001/p/15699687.html
最新文章
MySQL
Python通过分页对数据进行展示
内置函数,内存地址相关
IP地址转为二进制,去掉0b补齐八位拼接,再转为十进制
函数的参数,作用域.
简单函数.
替换敏感字符,统计,乘法表,函数
深浅拷贝及文件操作
列表,字典,集合,内存相关
字典,join
热门文章
构建用户列表,并使用列表中的帐户登陆.
写代码:使用While循环实现输出2-3+4-5+6...+100的和。
写代码:实现用户输入用户名和密码,当用户名为seven或者Alex且密码为123时,显示登录成功,否则失败,失败时允许重复输入三次。
写代码:实现用户输入用户名和密码,当用户名为seven且密码为123时,显示登录成功,否则失败,失败时允许重复输入三次。
写代码: 实现用户输入用户名和密码,当用户名为seven且密码为123时,显示登录成功,否则登录失败。
如何查看变量在内存中的地址?
表单验证
jQuery
DOM进阶、绑定事件的方式、定时器
JavaScript进阶
Copyright © 2011-2022 走看看