中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當前位置: 首頁 > news >正文

網(wǎng)站式登錄頁面模板下載營銷軟文范例大全

網(wǎng)站式登錄頁面模板下載,營銷軟文范例大全,做游戲直播那個網(wǎng)站好,在國外網(wǎng)站付款要怎么做無樣式上傳圖片 創(chuàng)建一個 FormData 對象:這個對象可以用于存儲數(shù)據(jù)。 將文件添加到 FormData 對象:通過 append() 方法,將用戶選擇的文件添加到 formData 對象中。 使用 fetch 發(fā)送請求:使用 fetch API 或者其他方法將 FormDat…

無樣式上傳圖片

創(chuàng)建一個 FormData 對象:這個對象可以用于存儲數(shù)據(jù)。

將文件添加到 FormData 對象:通過 append() 方法,將用戶選擇的文件添加到 formData 對象中。

使用 fetch 發(fā)送請求:使用 fetch API 或者其他方法將 FormData 對象發(fā)送到服務(wù)器。

<!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>// 上傳圖片的函數(shù)function uploadImage() {// 獲取文件輸入框元素const fileInput = document.getElementById("fileInput");// 創(chuàng)建formData對象,用于存儲要上傳的文件數(shù)據(jù)const formData = new FormData();formData.append("file", fileInput.files[0]); // 將選中的文件添加到formData對象中// 請求接口fetch("http://yikatong.kuxia.top/pc/common/upload", {method: "POST",body: formData, // 請求體是formData對象,其中包含文件數(shù)據(jù)}).then((response) => response.json()) // 服務(wù)器響應(yīng)成功后,解析JSON格式的響應(yīng)數(shù)據(jù).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(); // 創(chuàng)建formData對象,用于存儲要上傳的文件數(shù)據(jù)formData.append("file", fileInput.files[0]); // 將選中的文件添加到formData對象中// 請求接口fetch("http://yikatong.kuxia.top/pc/common/upload", {method: "POST",body: formData, // 請求體是formData對象,其中包含文件數(shù)據(jù)}).then((response) => response.json()) // 服務(wù)器響應(yīng)成功后,解析JSON格式的響應(yīng)數(shù)據(jù).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://www.risenshineclean.com/news/29266.html

相關(guān)文章:

  • 武漢自適應(yīng)網(wǎng)站沈陽線上教學
  • 怎么創(chuàng)網(wǎng)站賺錢嗎微信朋友圈廣告推廣代理
  • 怎么看深圳網(wǎng)站頁面設(shè)計寫一篇軟文推廣自己的學校
  • 歐泰國際物流網(wǎng)站市場營銷策略有哪些
  • 做網(wǎng)站建設(shè)推薦東莞百度網(wǎng)站排名優(yōu)化
  • 地產(chǎn)網(wǎng)站設(shè)計成都關(guān)鍵詞seo推廣平臺
  • 寧波seo快速優(yōu)化怎么做淘寶怎么優(yōu)化關(guān)鍵詞排名
  • 西安網(wǎng)站建設(shè)價格明細seo入門到精通
  • 微信公眾號直接鏈接網(wǎng)站怎么做長春網(wǎng)站seo
  • 游戲直播網(wǎng)站怎么做百度信息流開戶多少錢
  • 石家莊電子商務(wù)網(wǎng)站建設(shè)焦作網(wǎng)站seo
  • 旺蒼網(wǎng)站建設(shè)seo入門培訓學校
  • 南陽網(wǎng)站建設(shè)公司湖南官網(wǎng)網(wǎng)站推廣軟件
  • 網(wǎng)站驗證碼怎么做steam交易鏈接在哪
  • 溧陽做網(wǎng)站哪家好零基礎(chǔ)學什么技術(shù)好
  • html5畢業(yè)設(shè)計題目大全福州百度推廣排名優(yōu)化
  • 信用門戶網(wǎng)站建設(shè)專家評價免費網(wǎng)站收錄網(wǎng)站推廣
  • 一個域名權(quán)重3如果做網(wǎng)站的話權(quán)重會降為0嗎百度熱度榜搜索趨勢
  • 網(wǎng)站建設(shè)平臺策劃電腦優(yōu)化是什么意思
  • 陜西省建設(shè)銀行網(wǎng)站6seo如何優(yōu)化
  • ppt歡迎頁面模板網(wǎng)絡(luò)營銷中的seo與sem
  • 不在百度做推廣他會把你的網(wǎng)站排名弄掉怎么可以讓百度快速收錄視頻
  • 昆明網(wǎng)站建設(shè)-中國互聯(lián)精準客戶數(shù)據(jù)采集軟件
  • 小學網(wǎng)站源碼php個人在線做網(wǎng)站免費
  • 做網(wǎng)站話掙錢嗎google下載官網(wǎng)
  • 武平縣網(wǎng)站建設(shè)搜索引擎競價廣告
  • seo優(yōu)化價格seo1搬到哪里去了
  • 樂清網(wǎng)站設(shè)計公司哪家好百度 營銷中心
  • 哈爾濱自助建站模板網(wǎng)站推廣軟件
  • 萊蕪金點子信息港最新招聘信息港南寧seo優(yōu)化公司