HTML DOM ins cite 属性
htmlweb developmentfront end technology更新于 2025/6/17 0:12:17
HTML DOM ins cite 属性返回文档的 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>
输出
这将产生以下输出 −
点击"显示证据"按钮之前 −

点击"显示证据"按钮之后 −

相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

