Button formEnctype Attribute

Definisyon at paggamit

formEnctype Paraan ng setting at pagbalik ng formenctype attribute na ito.

Ang formenctype attribute ay nagtutukoy kung paano ang datos ng porma ay dapat ma-encode bago ito ipapadala sa server. Ang attribute na ito ay sumasupil sa halaga ng form na enctype attribute.

Ang formenctype attribute ay gamit lamang para sa button na may type="submit".

Komento:formenctype attribute Ito ay isang bagong attribute ng HTML5 <button> element.

Halimbawa

Halimbawa 1

Ibalik ang kung paano ang datos ng porma ay dapat ma-encode bago ito ipapadala sa server:

var x = document.getElementById("myBtn").formEnctype;

Subukan ang sarili

Halimbawa 2

Ibaguhin ang halaga ng formenctype attribute ng button mula "text/plain" tungo sa "application/x-www-form-urlencoded":

document.getElementById("myBtn").formEnctype = "application/x-www-form-urlencoded";

Subukan ang sarili

Halimbawa 3

Isang halimbawa ng ibang pagbalik ng formEnctype attribute:

var x = document.getElementById("myBtn").formEnctype;

Subukan ang sarili

Gramata

Ibalik ang formEnctype attribute:

buttonObject.formEnctype

I-set ang formEnctype attribute:

buttonObject.formEnctype = "application/x-www-form-urlencoded,multipart/form-data,text/plain"

Halaga ng attribute

Halaga Paglalarawan
application/x-www-form-urlencoded Lahat ng character ay na-encode bago ito ipapadala (default).
multipart/form-data Hindi nag-encode ng character. Kapag gumagamit ka ng porma na may file upload control, ang halaga na ito ay kinakailangan.
text/plain Spaces are converted to "+" symbol, but special characters are not encoded.

Technical Details

Return Value: String value, representing the content type used to submit the form to the server.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support

Related Pages

HTML Reference Manual:HTML <button> formenctype Ating Tadyang