Home > Mobile >  problem with javascript and css in html page using windows xp chrome
problem with javascript and css in html page using windows xp chrome

Time:04-25

problem in using code HTML, CSS, JS in chrome xp

hi i got this function that do brightnes on full page by clicking on button

<html id="html">
    <button onclick="brightness()">lightting</button>
    <script>
    function brightness(){document.getElementById('html').style.filter = 
    "brightness(140%)";}
</script>
</html>

the code work in other chrome browsers (like chrome version 90) but in windows xp chrome its not what the problem (is it the javascript?)? what can i change so it will work?

CodePudding user response:

enter image description here

function brightness() {
  document.getElementById('html').classList.toggle("bright");
}
.bright {
  -webkit-filter: brightness(140%);
  filter: brightness(140%);
}
<html id="html">
<button onclick="brightness()">lighting</button>

CodePudding user response:

I'm not sure what version of Chrome you are running on your Windows XP, but according to caniuse, CSS-filters such as brightness were added in Chrome version 18, and have been supported since 2010.

If you're running an older version of chrome, that's why it doesn't work.

  • Related