相关疑难解决方法(0)

未捕获的DOMException:无法读取'cssRules'属性

我不知道为什么我的脚本不能在Firefox上使用,而在谷歌浏览器上却不能使用

JS:

var _timelineWidth = (Number.parseInt(document.styleSheets[0].cssRules[16].style.width) / 100) * document.body.clientWidth;
Run Code Online (Sandbox Code Playgroud)

CSS:

#timeline {
  position: relative;
  top: 15px;
  left: 12.5%;
  height: 5px;
  background: #aaa;
  border-radius: 2.5px;
  cursor: pointer;
}
Run Code Online (Sandbox Code Playgroud)

这是chrome的错误代码

未捕获的DOMException:无法从“ CSSStyleSheet”读取“ cssRules”属性:无法访问规则

javascript google-chrome

2
推荐指数
2
解决办法
4668
查看次数

标签 统计

google-chrome ×1

javascript ×1