<html>
<body>
<p>单击按钮可创建一个 Q 元素,其中包含指向 wwf.org 的链接作为引用的来源。</p>
<button onclick="myFunction()">试一试</button>
<script>
function myFunction() {
var x = document.createElement("Q");
var t = document.createTextNode("我们的目标是建设一个人与自然和谐相处的未来。");
x.setAttribute("cite", "http://www.wwf.org");
x.appendChild(t);
document.body.appendChild(x);
}
</script>
</body>
</html>