Javascript can't catch the top? of the film.

Hello, everyone. I want to make a bad response on the web, so I wrote a paragraph of javascript and inserted it in html:

<img class="graphic_001" src="img/parallax_graphic/tri-yellow.svg"/>
                <script type="text/javascript">
                        function parallex () {
                        var img = window.pageYOffset;
                        var a = document.getElementsByClassName("graphic_001");
                        var speed = 0.8;
                        a.style.top = img * speed +"px";
                    }
                    window.addEventListener("scroll",parallex);
                </script>

but after opening the browser, the explorer failed to catch the top, of the clip and will report as soon as it is activated:

how should I correct the javascript if I want to? At present, confirm that the video has been posted on the web, please listen to your answers!

Mar.31,2021

The return value of

getElementsByClassName is an array structure of nodeList, class, so you should take the angle sign

.
 a[0].style.top = img * speed +'px';

whether it works to try to modify it like this


first as mentioned above
the src loading of the second img requires a process, so it is recommended to add the mouth function window.onload or img.onload

.
Menu