The cite
attribute specifies the source URL of a quotation.
The cite
property sets or gets the value of the cite attribute of a quotation.
cite |
Yes | Yes | Yes | Yes | Yes |
Return the cite property.
var v = quoteObject.cite
Set the cite property.
quoteObject.cite=URL
Value | Description |
---|---|
URL | Specifies the source URL of the quotation. |
A String type value representing the URL of the source document.
The following code shows how to Change the URL of a quotation.
<!DOCTYPE html>
<html>
<body>
<q id="myQuote" cite="http://www.example.com">quote</q>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<!-- w w w . j ava 2 s. c o m-->
<script>
function myFunction() {
document.getElementById("myQuote").cite = "http://www.example.com/url.htm";
document.getElementById("demo").innerHTML = "changed";
}
</script>
</body>
</html>
The code above is rendered as follows:
The following code shows how to get the URL of a quotation.
<!DOCTYPE html>
<html>
<body>
<q id="myQuote" cite="http://www.example.com">quote</q>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {<!-- w ww. ja va 2 s . com-->
var x = document.getElementById("myQuote").cite;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows: