- 1
Good morning sir. I want to change src attribute value. I do getElementById with id msrc. Thanks you sir.
change src with JavaScript. https://code.sololearn.com/WDUY6LfYW6lI/?ref=app
1 Respuesta
+ 1
<!DOCTYPE html>
<html>
<head>
<title>change p and img</title>
</head>
<body>
<p id="image"><button onclick="fun()">click me</button></p>
<img id="msrc" src="https://mimo.app/i/panda.png">
<scrip>
function fun() {
document.getElementById ("image").innerHTML = 67;
document.getElementById ("msrc").src = "https://mimo.app/i/kittles.png";
}
</scrip>
</body>
</html>
edit:
change tag scrip to script spelling in above code.