HTML-DOM - Body -Objekt
Körperobjekt
Das Body-Objekt repräsentiert ein HTML-<body>-Element.
Greifen Sie auf ein Körperobjekt zu
Sie können auf ein <body>-Element zugreifen, indem Sie getElementsByTagName() verwenden:
Beispiel
var x = document.getElementsByTagName("BODY")[0];
Tipp: Sie können auch auf ein <body>-Element zugreifen, indem Sie die Eigenschaft document.body verwenden.
Erstellen Sie ein Körperobjekt
Sie können ein <body>-Element erstellen, indem Sie die Methode document.createElement() verwenden:
var x = document.createElement("BODY");
Körperobjekteigenschaften
Property | Description |
---|---|
aLink | Not supported in HTML5. See CSS :active Selector instead.
Sets or returns the color of an active link in a document |
background | Not supported in HTML5. Use style.backgroundImage instead. Sets or returns the background image for a document |
bgColor | Not supported in HTML5. Use style.backgroundColor instead. Sets or returns the background color of a document |
link | Not supported in HTML5. See CSS :link Selector instead. Sets or returns the color of unvisited links in a document |
text | Not supported in HTML5. Use style.color instead. Sets or returns the color of the text in a document |
vLink | Not supported in HTML5. See CSS :visited Selector instead.
Sets or returns the color of visited links in a document |
Standardeigenschaften und -ereignisse
Das Body-Objekt unterstützt auch die Standardeigenschaften und -ereignisse .
Verwandte Seiten
HTML-Referenz: HTML-<body>-Tag