Style quotes 属性

Style 对象参考手册 Style 对象

定义和用法

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 属性的值从父元素继承。


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要浏览器都支持 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>

尝试一下 »


Style 对象参考手册 Style 对象