I'm a rookie at javascript. I'm trying to open an html file in the same directory when clicking an image. (My image displays but the onclick function doesn't work).
projects = document.createElement('div');
projects.style.position = 'absolute';
projects.innerHTML = '<img src="image.png" class="projectspage" style="display:block; margin-top: 50px; margin-left: 100px; background-color: red; height: 100px; width: 100px;" />';
projects.onClick = function() {
window.open('projects.html')
};
uiContainer.appendChild(projects);