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
"promeni_sliku"=Change picture
"stslika"=Stands for older picture

        <title>Untitled Document</title>
        <img id="ram" src="" width="150" height="100"/>
        Slika:<input id="naslov"></input> 
        <button onClick="promeni_sliku()">Promeni</button>
        <button onClick="undo()">Undo</button>    
            var stslika;
            function promeni_sliku()
                var ram=document.getElementById('ram');
                var naslov=document.getElementById('naslov');
            function undo()
                var ram=document.getElementById('ram')


use an array and insert into every change happen, every element of the array is a step forward.(you can use many array one for ram and another for slika and so on )
jquery will help you.
advice "use meaningful english word when naming".
good luck

I am kind of confused with "array", sorry i am pretty new with this, could you show me a small example? Sorry for asking too much. Also i am using dreamweaver if this means anything, as for naming, it wasn't mine, teacher did all namings.