-1

I am extracting results from a database and everything works fine except this line which gives me an error for every result.

Basically I have an <area> of the same coords as every <polygon>'s points of my <svg> and I'm trying to update the polygon's fill-opacity when I hover the area.

document.getElementById('TEST_area').onmouseenter=function(){ document.getElementById('TEST').style.fill-opacity = '0.5;'; };

I really don't know what happened here, because at some point it worked.

The coords are not a problem, they work, because whenever I click on my areas, I get the response I want. But not for onmouseenter and onmouseleave

Thank you.

hydravink
  • 63
  • 1
  • 1
  • 11
  • 4
    `'".$row['regionname']."_area'` is an invalid string literal – adiga Dec 30 '19 at 13:37
  • No it is not. The problem is in the `function()` part, because if I change whatever I'm trying to do there, let's say change `innerHTML` of something, it will work. It seems that `style.fill-opacity` is not the right way. – hydravink Dec 30 '19 at 13:40
  • Copy/paste that into your console; it is not syntactically correct, at least not as plain JavaScript. – Pointy Dec 30 '19 at 13:41
  • 1
    This is being outputted by a php script correct? – Ian Middelkamp Dec 30 '19 at 13:42
  • Yes I am outputting this by PHP. The problem is clearly at the function() part because just now I have changed `style.fill-opacity: 0.5` to `style = 'fill: yellow'` and this works good but doesn't help me. Also, using `style = 'fill-opacity: 0.5'` clearly won't work because that's gonna be the whole style and I'm losing other properties. – hydravink Dec 30 '19 at 13:44
  • 1
    `fill-opacity` is not a valid property name. Rather, it's a subtraction. – Ruud Helderman Dec 30 '19 at 13:45
  • Alright, that was it. I changed `fill-opacity` to `fillOpacity` and now it works. – hydravink Dec 30 '19 at 13:50

1 Answers1

-1

Try removing the semi-colon from your 0.5 fill-opacity