Create a Quote Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Quote

Introduction

You can create a <q> element by using the document.createElement() method:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">create a QUOTE element with a link to wwf.org as the source of the quotation</button>

<script>
function myFunction() {//  w  w  w . j  a v a  2  s.c o m
    var x = document.createElement("QUOTE");
    var t = document.createTextNode("test test test.");
    x.setAttribute("cite", "http://java2s.com/resources/a.png");
    x.appendChild(t);
    document.body.appendChild(x);
}
</script>

</body>
</html>

Related Tutorials