This is really stupid question and i feel ashamed to ask but i kinda have to. So here is the thing, in my college/school we got some sort of homework which isn't a "must do" but i wish to for myself, so thing we need to do is, when i activate undo button, it needs to change back to picture which was there after the new picture was added infinite ammount of times, for example if i change picture five times, it needs to undo the change five times and so on. And sadly i have no idea how to make undo button work like that, so any help is appreciated. Thanks in forward. PS: Sorry for my terrible English, English isn't my main language and sorry for bad explanation and i think once you see code below you might realize what i was talking about.
Since this code contains some words of my main language i will translate them for better understanding.
"ram"= Frame, more like frame for picture
"slika"=Picture
"naslov"=Title
"promeni_sliku"=Change picture
"stslika"=Stands for older picture
<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<img id="ram" src="http://phototony.com/wp-content/uploads/2014/03/wolf-wallpapersimages-pictures-of-beautiful-animals-images-the-wolf-hd-wallpaper.jpg" width="150" height="100"/>
<br/>
Slika:<input id="naslov"></input>
<br/>
<button onClick="promeni_sliku()">Promeni</button>
<button onClick="undo()">Undo</button>
</body>
<script>
var stslika;
function promeni_sliku()
{
var ram=document.getElementById('ram');
var naslov=document.getElementById('naslov');
stslika=ram.src
ram.src=naslov.value;
}
function undo()
{
var ram=document.getElementById('ram')
ram.src=stslika;
}
</script>
</html>