This article describes the method of modifying src in JavaScript. Share it for your reference. The specific implementation method is as follows:
Copy the code as follows: <!DOCTYPE html>
<html>
<head>
<title>Use js to change pictures</title>
<script>
function changeImage() {
var element = document.getElementById('myimage');
element.src = "image/a/053120.jpg";
}
</script>
</head>
<body>
<h1>Use js to change the picture</h1>
<p>Please click the button <a href="a/html/054210.htm">Original text</a></p>
<img id="myimage" src="image/a/054210.jpg" />
<input name="meinv" type='button' value="change image" onclick="changeImage()">
</body>
</html>
I hope this article will be helpful to everyone's JavaScript programming.