Event: thuộc tính returnValue

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

Note: This feature is available in Web Workers.

Thuộc tính Event returnValue cho biết hành động mặc định của sự kiện này đã bị ngăn hay chưa.

Theo mặc định, nó được đặt thành true, cho phép hành động mặc định xảy ra. Việc đặt thuộc tính này thành false sẽ ngăn hành động mặc định.

Note: Mặc dù returnValue đã được đưa vào chuẩn DOM, nó chủ yếu tồn tại để hỗ trợ mã hiện có. Hãy dùng preventDefault()defaultPrevented thay vì thuộc tính lịch sử này.

Giá trị

Một giá trị boolean, là true nếu sự kiện chưa bị hủy; ngược lại, nếu sự kiện đã bị hủy hoặc hành động mặc định đã bị ngăn, giá trị là false.

Giá trị của returnValue là nghịch đảo của giá trị được trả về bởi defaultPrevented.

Thông số kỹ thuật

Specification
DOM
# dom-event-returnvalue

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

Xem thêm