HTMLFormElement: thuộc tính method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Thuộc tính HTMLFormElement.method đại diện cho phương thức HTTP được sử dụng để gửi <form>.

Trừ khi được chỉ định rõ ràng, phương thức mặc định là 'get'.

Giá trị

Một chuỗi.

Ví dụ

js
document.forms["my-form"].method = "post";

const formElement = document.createElement("form"); // Tạo một biểu mẫu
document.body.appendChild(formElement);
console.log(formElement.method); // 'get'

Đặc điểm kỹ thuật

Specification
HTML
# dom-fs-method

Tương thích trình duyệt