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>

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.