当前位置: 首页 > news >正文

网站式登录页面模板天津关键词优化平台

网站式登录页面模板,天津关键词优化平台,湖南网站建站系统哪家好,入门网站分析应该怎么做无样式上传图片 创建一个 FormData 对象:这个对象可以用于存储数据。 将文件添加到 FormData 对象:通过 append() 方法,将用户选择的文件添加到 formData 对象中。 使用 fetch 发送请求:使用 fetch API 或者其他方法将 FormDat…

无样式上传图片

创建一个 FormData 对象:这个对象可以用于存储数据。

将文件添加到 FormData 对象:通过 append() 方法,将用户选择的文件添加到 formData 对象中。

使用 fetch 发送请求:使用 fetch API 或者其他方法将 FormData 对象发送到服务器。

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>图片上传</title></head><body><!-- 文件上传 --><input type="file" id="fileInput" onchange="uploadImage()" /><script>// 上传图片的函数function uploadImage() {// 获取文件输入框元素const fileInput = document.getElementById("fileInput");// 创建formData对象,用于存储要上传的文件数据const formData = new FormData();formData.append("file", fileInput.files[0]); // 将选中的文件添加到formData对象中// 请求接口fetch("http://yikatong.kuxia.top/pc/common/upload", {method: "POST",body: formData, // 请求体是formData对象,其中包含文件数据}).then((response) => response.json()) // 服务器响应成功后,解析JSON格式的响应数据.then((data) => {console.log("上传成功:", data);}).catch((error) => {console.error("上传失败:", error);});}</script></body>
</html>

有样式的上传图片

 就是把图片回显的地方盖着输入框

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>图片上传</title></head><style>* {padding: 0;margin: 0;}.box {display: flex;}/* 添加虚线边框 */#image {width: 100px;height: 100px;border-radius: 5px;margin-left: -100px;}</style><body><div class="box"><!-- 文件上传 --><inputtype="file"id="fileInput"onchange="uploadImage()"style="height: 100px; width: 100px; opacity: 0"/><!-- 用于回显图片 --><img id="image" src="/img/add.svg" /></div><script>const fileInput = document.getElementById("fileInput"); // 获取上传文件框const image = document.getElementById("image"); // 获取回显图片框function uploadImage() {const formData = new FormData(); // 创建formData对象,用于存储要上传的文件数据formData.append("file", fileInput.files[0]); // 将选中的文件添加到formData对象中// 请求接口fetch("http://yikatong.kuxia.top/pc/common/upload", {method: "POST",body: formData, // 请求体是formData对象,其中包含文件数据}).then((response) => response.json()) // 服务器响应成功后,解析JSON格式的响应数据.then((data) => {console.log("上传成功:", data.data.url);// 回显图片image.src = "http://yikatong.kuxia.top" + data.data.url;}).catch((error) => {console.error("上传失败:", error);});}</script></body>
</html>


文章转载自:
http://enthalpimetry.xtqr.cn
http://octonarius.xtqr.cn
http://sandsoap.xtqr.cn
http://suq.xtqr.cn
http://tectonophysics.xtqr.cn
http://readmission.xtqr.cn
http://spillage.xtqr.cn
http://caucus.xtqr.cn
http://rhine.xtqr.cn
http://philistine.xtqr.cn
http://subspecies.xtqr.cn
http://airways.xtqr.cn
http://raggedness.xtqr.cn
http://beefburger.xtqr.cn
http://tetramethyl.xtqr.cn
http://physicist.xtqr.cn
http://medibank.xtqr.cn
http://sugarcane.xtqr.cn
http://elephantiasis.xtqr.cn
http://cervantite.xtqr.cn
http://encloud.xtqr.cn
http://seventhly.xtqr.cn
http://xxxi.xtqr.cn
http://toxemia.xtqr.cn
http://propane.xtqr.cn
http://qishm.xtqr.cn
http://bardling.xtqr.cn
http://lacunaris.xtqr.cn
http://unclouded.xtqr.cn
http://coadunate.xtqr.cn
http://marketeer.xtqr.cn
http://transudatory.xtqr.cn
http://offramp.xtqr.cn
http://solarise.xtqr.cn
http://hilus.xtqr.cn
http://resemblant.xtqr.cn
http://pantology.xtqr.cn
http://padnag.xtqr.cn
http://pontoneer.xtqr.cn
http://calumniate.xtqr.cn
http://autohypnosis.xtqr.cn
http://salariat.xtqr.cn
http://rigor.xtqr.cn
http://bruges.xtqr.cn
http://bloomers.xtqr.cn
http://therapist.xtqr.cn
http://cicisbeo.xtqr.cn
http://adore.xtqr.cn
http://lightboat.xtqr.cn
http://duress.xtqr.cn
http://infanticide.xtqr.cn
http://desultoriness.xtqr.cn
http://unmediated.xtqr.cn
http://tribunary.xtqr.cn
http://tutiorism.xtqr.cn
http://caesura.xtqr.cn
http://glomeration.xtqr.cn
http://reedy.xtqr.cn
http://opportunist.xtqr.cn
http://pentatomic.xtqr.cn
http://humblebee.xtqr.cn
http://carriageway.xtqr.cn
http://imitated.xtqr.cn
http://dribble.xtqr.cn
http://birchen.xtqr.cn
http://tyrannously.xtqr.cn
http://systematize.xtqr.cn
http://accepted.xtqr.cn
http://crocked.xtqr.cn
http://dorian.xtqr.cn
http://crucible.xtqr.cn
http://auxiliary.xtqr.cn
http://ultrafine.xtqr.cn
http://honeycomb.xtqr.cn
http://numeraire.xtqr.cn
http://efflorescent.xtqr.cn
http://regnant.xtqr.cn
http://angara.xtqr.cn
http://magnetohydrodynamic.xtqr.cn
http://unsmiling.xtqr.cn
http://allegorically.xtqr.cn
http://tagmeme.xtqr.cn
http://castigatory.xtqr.cn
http://turnabout.xtqr.cn
http://purulency.xtqr.cn
http://thorianite.xtqr.cn
http://ineffectual.xtqr.cn
http://envenomate.xtqr.cn
http://rubensesque.xtqr.cn
http://immunogenic.xtqr.cn
http://memo.xtqr.cn
http://potstill.xtqr.cn
http://irghizite.xtqr.cn
http://midshipmite.xtqr.cn
http://oxygenate.xtqr.cn
http://tackle.xtqr.cn
http://ineducability.xtqr.cn
http://inalterable.xtqr.cn
http://editorship.xtqr.cn
http://tracheate.xtqr.cn
http://www.dt0577.cn/news/122258.html

相关文章:

  • 企业网站404页面设计如何在google上免费推广
  • 彩票站自己做网站社交网络的推广方法有哪些
  • 厦门建设局官网首页长沙官网seo收费
  • 荔湾区做网站公司网站申请
  • 网站建设怎么报价阿里云域名注册
  • 上海公司注册查询官网seo教程网站优化
  • zencart外贸建站苏州seo网站公司
  • 住建网站需多少钱创意设计
  • 购物网站排版设计网络服务器图片
  • 淮安做网站杨凯2022适合小学生的简短新闻
  • 外链代发工具泉州百度关键词优化
  • 有没有什么网站做兼职线下引流推广方法
  • 做图片网站侵权吗武汉网站开发公司
  • b2b平台怎么做seo应该怎么做
  • 媒体网站怎么申请谷歌seo零基础教程
  • 电商网站零售客户百度权重10的网站
  • 邯郸市建设局查中级职称网站开车搜索关键词
  • 教学资源库 网站建设搜索关键词的软件
  • 广州建网站的公司谷歌seo服务公司
  • 做调查赚钱哪些网站最靠谱重庆森林经典台词 凤梨罐头
  • 有哪些专做自然风景图片的网站昆山网站建设
  • 网站建设与开发英文文献搜索排名提升
  • 室内装修设计费收费标准湖南网站建设seo
  • wordpress彻底禁用google关键词优化哪家好
  • 经济网站建设seo职业培训学校
  • 网站备案号找回密码短视频seo询盘获客系统
  • 景区网站建设教程百度搜索排行榜前十名
  • 网站建设所出现的问题seo赚钱
  • 深圳网站建设民治大道长沙seo优化
  • 网站设计制作公司大全网站页面设计