Stuck on a slideshow

Hi, i don’t know if i’m posting this in the good category but, i’m stuck on a slideshow, console says :

"index2.html:16 Uncaught ReferenceError: affiche is not defined
at HTMLImageElement.onclick (index2.html:16)
onclick @ index2.html:16"

Pls Halp.

<!DOCTYPE html>
<html>
<head>
	<title>Wot</title>
	<link rel="stylesheet" href="../assets/css/styles2.css">
</head>
<body>
	<script type="JavaScript">
		i = 1;
		function affiche(numero) {
		i = numero;
  		img.src = i+'.jpg';
}
	</script>
	<p class="Content">
		<img name="img" class="Contentelse" src="C:/Users/Flori/Pictures/Posters/Artorias.jpg" OnClick="affiche(i+1)">
	</p>
</body>
</html>


Try defining affiche in a different notation:

i=1;
var affiche = function(numero){
  i = numero;
  img.src = i+'.jpg';
}
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.