I want to code that when I click on a image the src of this image changes to another src. But it doesn't work. Can someone help me?
<?php require_once("php/config.php"); ?>
<!DOCTYPE html>
<html>
<head>
<title> test </title>
<script type="text/javascript" src="javascript/liabary.js"></script>
</head>
<body>
<img id="img" onclick="next()" src="img/bildergalerie/bild3.jpg" id="b3" width="1000" height="500" alt="image" />
<script type="text/javascript">
function next() {
var img = document.getElementByIdName("img");
img.src = "image2.jpg";
}
</script>
</body>
</html>