Bootstrap表单不会使用图像按钮提交

时间:2014-11-02 16:34:14

标签: php html forms twitter-bootstrap submit

我用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> 

3 个答案:

答案 0 :(得分:2)

您的提交按钮需要是一个按钮/提交并使用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>

答案 1 :(得分:1)

它提交表单,但以图像的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>

答案 2 :(得分:0)

尝试添加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!">