The Footer
class represents an HTML <footer> element.
The Footer object supports the standard properties and events.
The following code shows how to get a <footer> element by using getElementById().
<!DOCTYPE html>
<html>
<body>
<footer id="myFooter">
<p>my footer.</p>
</footer><!-- w w w . ja va 2s .co m-->
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myFooter").innerHTML;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows:
The following code shows how to create a <footer> element by using the document.createElement() method.
<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {<!--from w ww . j a va 2 s . co m-->
var x = document.createElement("FOOTER");
x.setAttribute("id", "myFooter");
document.body.appendChild(x);
var y = document.createElement("P");
var t = document.createTextNode("my footer.");
y.appendChild(t);
document.getElementById("myFooter").appendChild(y);
}
</script>
</body>
</html>
The code above is rendered as follows: