Set this in head
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
jquery code
setInterval(function(){
$('#img').remove();
$('body').prepend('<img src="urlimgs" id="img">');
},5000);
I didn't understand what you want but it is so basic! You need learn more about jquery..
You can improve this code.. it is only a example