Thursday, September 29, 2016

Random iFrame Fickle if Refresh

  1. Layout
  2. Add a Gadget
  3. HTML/JavaScript
Paste this script :


<script language="JavaScript1.2">

//Random iframe content- (c) Dynamic Drive (www.dynamicdrive.com)
//For full source code, and Terms Of use, visit http://dynamicdrive.com
//This credit MUST stay intact for use

var ie=document.all&&navigator.userAgent.indexOf("Opera")==-1
var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1

//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]="http://images.clipartpanda.com/one-clipart-KcjeKL8ji.png"
randomcontent[1]="http://www.clipartkid.com/images/83/number-2-finkorswim-com-Ybr9lV-clipart.png"
randomcontent[2]="https://s-media-cache-ak0.pinimg.com/564x/34/05/19/340519c65bc817cf6d333585937f277d.jpg"
randomcontent[3]="https://marysoljames.files.wordpress.com/2014/06/polka-dot-number-4.jpg?w=736"

//No need to edit after here
if (ie||dom)
document.write('<iframe id="dynstuff" src="" '+iframeprops+'></iframe>')

function random_iframe(){
if (ie||dom){
var iframeobj=document.getElementById? document.getElementById("dynstuff") : document.all.dynstuff
iframeobj.src=randomcontent[Math.floor(Math.random()*randomcontent.length)]
}
}

window.onload=random_iframe

</script>



note : blue color will show up every refresh fluctuations, please use the link of your image file

 DEMO : 
please refer to the right

No comments:

Post a Comment