亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

點擊 html 提交圖片上的表單

點擊 html 提交圖片上的表單

慕神8447489 2023-08-18 17:26:07
我試圖在單擊幻燈片圖像時基本上提交我的表單。我創建了一個表單,并使用 來輸入值type="image",但今天意識到某些瀏覽器不處理來自 的值輸入<input type="image">。最好的方法是什么?<form method="GET" action="/filtered">      <div class="slider-wrapper"><!-- innermost wrapper element -->                    <input class="slide" type="image" style="width: 100%; height: 60vh;" name="category" value="Car Cleaning Products" alt="Car Cleaning Products" src="../public/css/img/car-cleaning-slideshow.JPG">        <input class="slide" type="image" style="width: 100%; height: 60vh;" name="category" value="Car Cleaning Products" alt="Car Cleaning Products" src="../public/css/img/jan-supplies-slideshow.JPG">        <input class="slide" type="image" style="width: 100%; height: 60vh;" name="category" value="Car Cleaning Products" alt="Car Cleaning Products" src="../public/css/img/paper-products-slideshow.JPG">      </div>      </form>
查看完整描述

3 回答

?
墨色風雨

TA貢獻1853條經驗 獲得超6個贊

如果您確實希望將請求方法保留為 GET,則可以將 an 應用于id您的form標簽;然后將 an 添加onclick="submitForm()"到您的input標簽(這也適用于img標簽或任何標簽)。然后我們將用一些簡單的 JavaScript 代碼定義我們的函數。希望我有幫助!


<form id="form" method="GET" action="/filtered">

    <div class="slider-wrapper"><!-- innermost wrapper element -->            

        <input onclick="submitForm()" class="slide" type="image" style="width: 100%; height: 60vh;" name="category" value="Car Cleaning Products" alt="Car Cleaning Products" src="../public/css/img/paper-products-slideshow.JPG">

    </div>

</form>

<script>

function submitForm() {

    document.getElementById("form").submit();

}

</script>


查看完整回答
反對 回復 2023-08-18
?
至尊寶的傳說

TA貢獻1789條經驗 獲得超10個贊

使用method="post"get是獲取數據而不是發送數據。

我相信這會起作用


查看完整回答
反對 回復 2023-08-18
?
素胚勾勒不出你

TA貢獻1827條經驗 獲得超9個贊

只需將form方法更改為POST即可。


<form method="POST" action="/filtered">

  <div class="slider-wrapper">

    <!-- innermost wrapper element -->

    <input class="slide" type="image" style="width: 100%; height: 60vh;" name="category" value="Car Cleaning Products" alt="Car Cleaning Products" src="../public/css/img/car-cleaning-slideshow.JPG">

    <input class="slide" type="image" style="width: 100%; height: 60vh;" name="category" value="Car Cleaning Products" alt="Car Cleaning Products" src="../public/css/img/jan-supplies-slideshow.JPG">

    <input class="slide" type="image" style="width: 100%; height: 60vh;" name="category" value="Car Cleaning Products" alt="Car Cleaning Products" src="../public/css/img/paper-products-slideshow.JPG">

  </div>

</form>


查看完整回答
反對 回復 2023-08-18
  • 3 回答
  • 0 關注
  • 198 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號