Login Or Sign up

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

241 Views Asked by At

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?

2

There are 2 best solutions below

1
Sebastian On

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.

0
mplungjan On

MDN brightness says full support since v18

but

Chrome 49 is the last version to run on XP and according to can I use brightness you need -webkit

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>