That is bound to happen due to the fact that the script adds its content as a source change, adding to the history stack. This version will not do that:
Code:
<script type="text/javascript">
//Random iframe content- © Dynamic Drive (www.dynamicdrive.com)
//For TOS source code, and Terms Of use, visit http://dynamicdrive.com
//This credit MUST stay intact for use
//Modified here to not add to the history stack
//by jscheuer1 in http://www.dynamicdrive.com/forums
//Specify IFRAME display attributes
var iframeprops='width=130 height=130 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no"'
//Specify random URLs to display inside iframe
var randomcontent=new Array()
randomcontent[0]="random1.htm"
randomcontent[1]="random2.htm"
randomcontent[2]="random3.htm"
randomcontent[3]="random4.htm"
//No need to edit after here
if (document.getElementById||document.all)
document.write('<iframe id="dynstuff" src="'+randomcontent[Math.floor(Math.random()*randomcontent.length)]+'" '+iframeprops+'></iframe>')
</script>
Note: This will make the iframe retain its content until the page is navigated to afresh (using the back and forward buttons or refresh will generally not get you new content). You will need to click on a link to it or paste its address into the address bar and hit enter to get a change.
Bookmarks