所以我有这个代码(小提琴):
(function() {
var meter = document.getElementById('somemeter');
var Likes = document.getElementById('likes');
var Dislikes = document.getElementById('dislikes');
meter.max = Likes.innerHTML + Dislikes.innerHTML;
meter.value = Likes.innerHTML - Dislikes.innerHTML;
})();
<div id="likes">500</div>
<div id="dislikes">50</div>
<meter value="10" min="0" max="1000" id="somemeter"></meter>
如您所见,Likes.innerHTML
is500
和Dislikes.innerHTML
is 50
出于某种原因,当我使用or时;meter.max
不起作用 但是,当我用for和替换它们时,它确实有效。Likes.innerHTML
Dislikes.innerHTML
meter.max
500
50
难道我做错了什么?