Body backgroundPropiedades

Body 对象参考手册Objeto Body

Definición y uso

La propiedad background puede establecer o devolver el valor del atributo background del elemento body.

La propiedad background describe la imagen de fondo del documento.

Sintaxis

bodyObject.background=URL


Soporte del navegador

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Todos los navegadores principales admiten la propiedad background.


Ejemplo

Ejemplo

Devuelve el valor del atributo background del elemento body:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ejemplo (example.com)</title>
</head>
<body id="logo" background="logo.png">

<script>
document.write("La imagen de fondo es: ")
document.write(document.getElementById("logo").background);
</script>

</body>
</html>

Pruébalo »


Body 对象参考手册Objeto Body Otras extensiones