You can use the image element to submit a form.

Source: Internet
Author: User
 
Looking at the following code, I didn't understand the principle at the beginning, because I found that the form below does not have a submit button like input type = "Submit" that we usually call, there is no form in JavaScript. the submit is bound to a click event, so it gets stuck. However, you can submit the form by clicking the submit button of the image ....
IMG can also submit the form:
 
<form name="uploadForm" enctype="multipart/form-data" method="post" action="/ajax/designer_handler.php?item_id=<?=$item_id?>&tab=<?=$side?>&is_admin=<?=$is_admin?>" onsubmit="return uploadPhoto();"  style="display:inline"><input type="hidden" name="MAX_FILE_SIZE" value="25000000" style="display:inline;"><input type="hidden" name="uploading" /><?php $u_agent = $_SERVER['HTTP_USER_AGENT']; $btnText = "Browse";if(preg_match('/Chrome/i',$u_agent) || preg_match('/Safari/i',$u_agent)){$btnText = "Choose File";}$fonts_image_path = FontsImage::getImageUrl($design_id, $side);//var_dump($fonts_image_path);?>Upload up to 5 files at once<br />Click the <?= $btnText?> buttons to select files on your computer:<br /><br /><table cellspacing="5"><tr><td height="25">Photo: <input type="file" id="pathname1" name="pathname1" style="width:300px;" accept="image/jpeg" > </td></tr><tr><td height="25">Photo: <input type="file" id="pathname2" name="pathname2" style="width:300px;" accept="image/jpeg" > </td></tr><tr><td height="25">Photo: <input type="file" id="pathname3" name="pathname3" style="width:300px;" accept="image/jpeg" > </td></tr><tr><td height="25">Photo: <input type="file" id="pathname4" name="pathname4" style="width:300px;" accept="image/jpeg" > </td></tr><tr><td height="25">Photo: <input type="file" id="pathname5" name="pathname5" style="width:300px;" accept="image/jpeg" > </td></tr></table><br /><input id="upload_button" type="image" src="/images/personalize/upload.gif" >      <br /><span id="upload_message" style="font-style:italic; color:gray; visibility:hidden">Uploading...  (Large pictures may take some time to upload)</span><br /><br /></form>

Originally:

Form Control: input type = "image ")

Input type = image is equivalent to input type = submit. The difference is that input type = image uses an image as the form's submit button. The src attribute indicates the image path.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.