In an HTML web page I wrote this little script and CSS to animate a <div> using CSS animation :
Code: Select all
function play_FG(whichElement) {
element= document.getElementById(whichElement);
element.classList.add("animation_FG");
element.style.animationPlayState = "running";
}
function pause_FG(whichElement) {
element= document.getElementById(whichElement);
element.classList.remove("animation_FG");
}
Code: Select all
.animation_FG {
animation-name: fade_anim_FG;
animation-duration: 1s;
animation-play-state: paused;
animation-iteration-count: infinite;
}
@keyframes fade_anim_FG {
50% {opacity: 40%;}
}
Code: Select all
<button onmouseover="play_FG('targetRed')" onmouseleave="pause_FG('targetRed')" >Play Red</button>But inside my skin, when I try to modify an element ID = targetRed using a simple javascript :
Code: Select all
javascript:
play_FG('targetRed');I've got this error
. Any help will be very appreciated.
F.
