簡體   English   中英

Bootstrap 表單不會使用圖像按鈕提交

[英]Bootstrap form won't submit with image button

我用 Bootstrap 制作了一個表格。 有一個用於提交表單的圖像按鈕,但是當我單擊它時,什么也沒有發生。

<form name="input" action="index.php" method="post" class="form-horizontal">                    
    <div class="input-group">
        <span class="input-group-addon">@</span>
        <input name="coins" type="text" class="form-control" placeholder="Quanity" >
    </div><br>
    <div class="input-group">
        <span class="input-group-addon">@</span>
        <input type="text" class="form-control" name="usd" placeholder="USD" >
    </div><br>
    <div class="input-group">
        <span class="input-group-addon">@</span>
        <input  type="text" class="form-control" name="paypal" placeholder="PayPal Address" >
    </div><br>
    <div class="input-group">
        <input type="image" src="/img/ppbutton.png" name="submit" alt="PayPal - The safer, easier way to pay online!">
    </div><br>
</form> 

您的提交按鈕需要是一個按鈕/提交並使用 CSS 設置樣式:

<style>
div.submitter input {
    /*you will need to adjust your stylesheet so it looks the way you want.*/
    width: 100px;
    height: 40px;
    background-image: url(/img/ppbutton.png);
    background-repeat: no-repeat;
    border: 1px solid;
    }
</style>

<!-- REPLACE IN YOUR FORM -->
<div class="submitter"><input type="submit" name="submit" alt="PayPal - The safer, easier way to pay online!" /></div>

它提交表單,但它以圖像的 x 和 y 坐標的形式發送值。

例如:

<input type="submit" name="submit" alt="PayPal - The safer, easier way to pay online!" />

對於這個輸入 DOM 對象,它將發送submit.x=[some integer]submit.y=[some interger]

這是我使用的:

<button class="btn btn-default" type="submit" name="delete" value="delete">
     <img src="/delete.png" width="20" />
</button>

嘗試添加 this.form.submit 如下:

<input type="image" onclick="this.form.submit()" src="/img/ppbutton.png" name="submit" alt="PayPal - The safer, easier way to pay online!">

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM