I want to automatically resize parts of my Website with the onchange-Event. But as always I got a little problem to solve. Console gives this error:
The property undefined or a null reference can not be retrieved
".
function Resize() {
var winHeight = window.innerHeight;
var winWidth = window.innerWidth;
var startElements = document.getElementsByClassName('start');
for (var i = 1; i <= startElements.length; i++) {
document.startElements[i].attachEvent('onchange', function StartResize() {
startElements[i].style.paddingLeft = winWidth * 0.1;
startElements[i].style.paddingRight = winWidth * 0.1;
});
};
};
<body onload="Resize">
Last Thing. I already wrote the script-tag in my html document at the end of the body-tag.