我用 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!">
将其放入 html 表单中对我有用。