浏览器支持参考(http://www.runoob.com/jsref/prop-element-classlist.html) classList 是一个对象 ,返回值:一个 DOMTokenList, 包含元素的类名列表 语法:element.classList 有一个属性 length 只读 方法: 1.add(class1, class2, ...) 在元素中添加一个或多个类名。 如果指定的类名已存在,则不会添加 ...
classList.prototype.add =function(value){if(typeof value !=="string")throwTypeError("the type of value is error");if(this.obj.classList){this.obj.classList.add(value); }else{var arr = value.replace(/^\s+|\s+$/g,"").split(/\s+/);this.obj.classList +=" "+arr.join(" ");...
function toggleTheme() { const body = document.body; body.classList.toggle...JavaScript 功能: toggleTheme 函数通过 classList.toggle ...
function toggleTheme() { const body = document.body; body.classList.toggle...JavaScript 功能: toggleTheme 函数通过 classList.toggle ...
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/54-worksheet/worksheet-page-layout.yaml await Excel.run(async (context) => { const farmSheet = context.workbook.worksheets.getItem("Print"); farmSheet.pageLayout.zoom = { scale: 200 ...
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/20-lists/organize-list.yaml// Gets information about the first list in the document.awaitWord.run(async(context) => {constlists = context.document.body.lists; lists.load("items");await...
1. classList属性 classList 属性的值为 DOMTokenList 对象,关于DOMTokenList官方解释是一组空格分隔的标记,与Array一样具有 length 属性,且索引从0开始,但无法使用 Array 对象的方法。 不过DOMTokenList 对象内置了 add,remove,contains 等方法,用于增删改查等操作;所以我们可以使用add,remove 像JQ中 addClass 与...
Word.ListCollection 注解 [ API 集:WordApi 1.3 ]pages 获取区域中页面的集合。 TypeScript 复制 readonly pages: Word.PageCollection; 属性值 Word.PageCollection 注解 [ API 集:WordApiDesktop 1.2 ]paragraphs 获取区域中的段落对象的集合。 TypeScript 复制 readonly paragraphs: Word.ParagraphCollect...
values()Returns an Iterator with the values in the list More Examples Add multiple classes to the an element: element.classList.add("myStyle","anotherClass","thirdClass"); Try it Yourself » Remove multiple classes from an element:
https://github.com/eligrey/classList.js/blob/master/classList.js if ("document" in self) { // Full polyfill for browsers with no classList support if (!("classList" in document.createElement("_"))) { (function (view) { "use strict"; if (!('Element' in view)) return; var clas...