Thuộc tính HTML <input> formtarget
Thí dụ
Một biểu mẫu có hai nút gửi, với các cửa sổ mục tiêu khác nhau:
<form action="/action_page.php">
<input type="text" id="fname" name="fname"><br><br>
<label
for="lname">Last name:</label>
<input type="text" id="lname"
name="lname"><br><br>
<input type="submit" value="Submit as normal">
<input type="submit" formtarget="_blank" value="Submit to a new window">
</form>
Định nghĩa và Cách sử dụng
Thuộc formtarget
tính chỉ định tên hoặc từ khóa cho biết vị trí hiển thị phản hồi nhận được sau khi gửi biểu mẫu.
Thuộc formtarget
tính ghi đè target
thuộc tính của <form>
phần tử.
Lưu ý: Thuộc formtarget
tính có thể được sử dụng với
type="submit"
và
type="image"
.
Hỗ trợ trình duyệt
Các số trong bảng chỉ định phiên bản trình duyệt đầu tiên hỗ trợ đầy đủ thuộc tính.
Attribute | |||||
---|---|---|---|---|---|
formtarget | Yes | 10.0 | Yes | 5.1 | 10.6 |
Cú pháp
<input formtarget="_blank|_self|_parent|_top|framename">
Giá trị thuộc tính
Value | Description |
---|---|
_blank | The response is displayed in a new window or tab |
_self | The response is displayed in the same frame (this is default) |
_parent | The response is displayed in the parent frame |
_top | The response is displayed in the full body of the window |
framename | The response is displayed in a named iframe |
❮ Thẻ HTML <input>