Style quotes 屬性

定義和用法
quotes 屬性設(shè)置或返回嵌入引用的引號類型。
語法
設(shè)置 quotes 屬性:
Object.style.quotes="none|string string string string|inherit"
返回 quotes 屬性:
Object.style.quotes
值 | 描述 |
---|---|
none | 默認。規(guī)定 "content" 屬性的 "open-quote" 和 "close-quote" 的值不會產(chǎn)生任何引號。 |
string string string string | 規(guī)定要使用的引號。前兩個值規(guī)定第一級引用嵌套,后兩個值規(guī)定下一級引號嵌套。 |
inherit | quotes 屬性的值從父元素繼承。 |
瀏覽器支持
所有主要瀏覽器都支持 quotes 屬性,除了 Internet Explorer 和 Safari。
實例
實例
更改引號:
<html>
<head>
<script>
function displayResult()
{
document.getElementById("q1").style.quotes="'<' '>' '[start]' '[end]'";
}
</script>
</head>
<body>
<q id="q1">This is a <q>quoted element</q> in another quoted element.</q>
<br>
<button type="button" onclick="displayResult()">Change quotation marks</button>
</body>
</html>
<head>
<script>
function displayResult()
{
document.getElementById("q1").style.quotes="'<' '>' '[start]' '[end]'";
}
</script>
</head>
<body>
<q id="q1">This is a <q>quoted element</q> in another quoted element.</q>
<br>
<button type="button" onclick="displayResult()">Change quotation marks</button>
</body>
</html>
嘗試一下 ?

更多建議: