Document: thuộc tính fgColor

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.

fgColor lấy/đặt màu foreground, hay màu văn bản, của tài liệu hiện tại.

Giá trị

Một chuỗi biểu diễn màu dưới dạng từ (ví dụ: "red") hoặc giá trị hexadecimal (ví dụ: "#ff0000").

Ví dụ

js
document.fgColor = "white";
document.bgColor = "darkblue";

Ghi chú

Giá trị mặc định cho thuộc tính này trong Mozilla Firefox là màu đen (#000000 trong hệ hexadecimal).

document.fgColor đã bị deprecated trong HTML specification. Phương án thay thế được khuyến nghị là thuộc tính CSS color (ví dụ: document.body.style.color = "red").

Đặc tả kỹ thuật

Thông số kỹ thuật
HTML
# dom-document-fgcolor

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