Style quotes 屬性

定義和用法
quotes 屬性設置或返回嵌入引用的引號類型。
語法
設置 quotes 屬性:
Object.style.quotes="none|string string string string|inherit"
返回 quotes 屬性:
Object.style.quotes
值 | 描述 |
---|---|
none | 默認。規定 "content" 屬性的 "open-quote" 和 "close-quote" 的值不會產生任何引號。 |
string string string string | 規定要使用的引號。前兩個值規定第一級引用嵌套,後兩個值規定下一級引號嵌套。 |
inherit | quotes 屬性的值從父元素繼承。 |
流覽器支持
所有主要流覽器都支持 quotes 屬性,除了 Internet Explorer 和 Safari。
實例
實例
更改引號:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>IT研修(xuhuhu.com)</title>
<script>
function displayResult(){
document.getElementById("q1").style.quotes="'<' '>' '[start]' '[end]'";
}
</script>
</head>
<body>
<q id="q1">這是一個<q>引號元素</q> 在其他的引號元素內。</q>
<br>
<button type="button" onclick="displayResult()">修改引號標記</button>
<p><b>注意:</b> 這個例子在IE和Safari不工作。</p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>IT研修(xuhuhu.com)</title>
<script>
function displayResult(){
document.getElementById("q1").style.quotes="'<' '>' '[start]' '[end]'";
}
</script>
</head>
<body>
<q id="q1">這是一個<q>引號元素</q> 在其他的引號元素內。</q>
<br>
<button type="button" onclick="displayResult()">修改引號標記</button>
<p><b>注意:</b> 這個例子在IE和Safari不工作。</p>
</body>
</html>
