javascript change image src
//change image src
document.getElementById('myImageID').src="images/my_other_image.png";
javascript change image src
//change image src
document.getElementById('myImageID').src="images/my_other_image.png";
javascript resize image
const img = document.querySelector('img');
//Width and height values must be integers
//Width and height are measured in pixels (px)
img.width = 128;
img.height = 128;
//To use other type of measeures (% em) style should be edited
//In this case it has to be a string
img.style.width = '10em';
img.style.height = '10em';
//Resize by input (min = 0; max = 100)
//Event mousemove is for a fluent effect
const range = document.querySelector('input[type=range]');
range.addEventListener('mousemove', evt => {
img.style.width = evt.target.value + '%';
});
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us