【发布时间】:2016-04-12 17:53:32
【问题描述】:
我的代码突然停止工作,问题是我想将范围值输出到范围的拇指。
这是我的代码:
<input id="slider1" type="range" min="5000" max="350000" step="1000" value="5000" name="beloeb" oninput="outputUpdate(value)" />
Js:
function outputUpdate(vol) {
function formatNumber (num) {
return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1.")
}
document.styleSheets[0].addRule('#slider1::-webkit-slider-thumb::before','content: "'+formatNumber(vol)+' DKK";');
}
这是在控制台中使用chrome时的错误:
未捕获的语法错误:无法在“CSSStyleSheet”上执行“addRule”:无法解析规则“#slider1::-webkit-slider-thumb::before { content: "8.000 DKK"; }'。
【问题讨论】:
标签: javascript html css