Blockquote cite Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Blockquote

Description

The cite property sets or gets the value of the cite attribute of a quotation, which controls the source URL of a quotation.

Set the cite property with the following Values

Value Description
URL Sets the source URL of the quotation.

Possible values:

  • An absolute URL - like cite="http://www.example.com/page.htm"
  • A relative URL - like cite="page.htm"

Return Value

A String, representing the URL of the source document

The following code shows how to return the URL of a quotation:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<blockquote id="myBlockquote" cite="http://www.java2s.com">
quote//from   w  w  w.  j  a v a  2  s  .  c  o  m
</blockquote>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {
    var v = document.getElementById("myBlockquote").cite;
    document.getElementById("demo").innerHTML = v;
}
</script>

</body>
</html>

Related Tutorials