HTML DOM ins cite 屬性返回文檔的 URL,該 URL 解釋插入文本的原因。
用法
以下是語法 -
返回字符串值
insObject.cite
示例
讓我們看一個例子ins cite屬性 -
<!DOCTYPE html>
<html>
<head>
<title>ins cite</title>
<style>
form {
width:70%;
margin:0 auto;
text-align:center;
}
* {
padding:2px;
margin:5px;
}
input[type="button"] {
border-radius:10px;
}
</style>
</head>
<body>
<form>
<fieldset>
<legend>ins-cite</legend>
<h1>Fact:</h1>
<p>Water cannot persist on moon's surface.<ins id="newInfo" cite="https://www.example.com/water-ice-moon-surface-confirmed.html">Water ice found on moon in 2018.</ins>
</p>
<input type="button" onclick="showURL()" value="Show Evidence">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
var divDisplay = document.getElementById("divDisplay");
var insCite = document.getElementById("newInfo");
function showURL() {
divDisplay.textContent = 'Evidence at:'+insCite.cite;
}
</script>
</body>
</html>
輸出
這將產生以下輸出 -
點擊前‘Show Evidence’按鈕 -
點擊後‘Show Evidence’按鈕 -
相關用法
- HTML DOM ins dateTime屬性用法及代碼示例
- HTML DOM insertAdjacentElement()用法及代碼示例
- HTML DOM insertAdjacentHTML()用法及代碼示例
- HTML DOM insertAdjacentText()用法及代碼示例
- HTML DOM insertBefore()用法及代碼示例
- HTML DOM indexedDB deleteDatabase()用法及代碼示例
- HTML DOM indexedDB databases()用法及代碼示例
- HTML DOM indexedDB cmp()用法及代碼示例
- HTML DOM indexedDB open()用法及代碼示例
- HTML DOM iFrame用法及代碼示例
- HTML DOM item()用法及代碼示例
- HTML DOM isSameNode()用法及代碼示例
- HTML DOM isDefaultNamespace()用法及代碼示例
- HTML DOM isEqualNode()用法及代碼示例
- HTML DOM Style overflowY屬性用法及代碼示例
- HTML DOM Document hidden屬性用法及代碼示例
- HTML DOM IFrame用法及代碼示例
- HTML DOM Textarea cols屬性用法及代碼示例
- HTML DOM Style pageBreakAfter屬性用法及代碼示例
- HTML DOM Base href屬性用法及代碼示例
注:本文由純淨天空篩選整理自AmitDiwan大神的英文原創作品 HTML DOM ins cite Property。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。