When you edit the style of an element using the following:
document.getElementById("Doc1").style.opacity = "value";
You are setting the inline style of an element, not the styles applied by the #Image block.
If you'd like to edit the styles applied by the #Image block, there is some browser support for it using functions like insertRule() and deleteRule().
Instead of editing the styles applied by a stylesheet, I would add or remove classes from elements.
<div id="my-div" class="is-running">test</div> <style> .is-running { animation-play-state: running; } .is-paused { animation-play-state: paused; } </style> <script> document.getElementById('my-div').classList.remove("is-running"); document.getElementById('my-div').classList.add("is-paused"); </script>