How to use image to submit form

php中世界最好的语言
Release: 2018-02-10 09:48:41
Original
2362 people have browsed it

This time I will show you how to use image to submit form, what are the precautions to use image to submit form, the following is a practical case, let's take a look.

The code is as follows:

<form method="post" action="formtest.html" target="_blank" name="formtest"> 
<input type="hidden" name="userid" value="userid"> 
<input type="hidden" name="username" value="username"> 
<input type="image" src="imagesubmit.gif" border="0"> 
</form>
Copy after login

I don’t want to use a button to submit the form, I want to use a nicer image to submit it

That way it will be submitted twice, the input itself is submitted once, and the js script is submitted again Submit once
Use
picture as the submit button. There are several methods as follows: 1.

<form method="post" action="formtest.jsp"> 
<input type="hidden" name="userid" value="userid"> 
<input type="hidden" name="username" value="username"> 
<input type="image" src="imagesubmit.gif" border="0"> 
</form>
Copy after login

Just as the original poster wrote, this is completely Yes

2.

<script> 
function formsubmit(){ 
document.formtest.action="formtest.jsp"; 
document.formtest.submit(); 
} 
</script> 
<form method="post" name="formtest"> 
<input type="hidden" name="userid" value="userid"> 
<input type="hidden" name="username" value="username"> 
<img src="imagesubmit.gif" border="0" onclick="formsubmit()"> 
</form>
Copy after login

This method is often used in hybrid

ProgrammingIf the parameters you want to submit change with the dynamically retrieved content

I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!

Related reading:

How to implement HTML-like command line interface

How to implement list loop with html+css+javascript Scroll

How to use button trigger to achieve background color flash

The above is the detailed content of How to use image to submit form. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template