PDA

View Full Version : Random Iframe Content w/ clickable content



DowntownEER
08-10-2006, 06:13 PM
1) Script Title: Random Iframe Content

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/randomiframe.htm

3) Describe problem:

I used this script and would like to make my random content (images) linkable. Script is below and help is much appreciated. Thanks!

<table cellpadding=0 cellspacing=0 width="100%" bgcolor=#fed500 style="border-top:1px groove #fed500"><td width=100% height="22px" class=whitefont align=center><b>Chick of the Day</b></td></table>
<div align=center style="margin-top:5px;"><table width=146px height=220px><td width=100% align=center valign=center><a href="#" style="display:block;width:100%;height:100%;text-decoration:none;">
<script language="JavaScript1.2">

//Random iframe content- &#169; 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=146 height=220 bgcolor=#003366 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"'
var openup='<a href="#">'
var closeup='</a>'

//Specify random URLs to display inside iframe
var randomcontent=new Array()
randomcontent[0]="http://www.virtualbluelot.com/Images/cod/1chick.jpg"
randomcontent[1]="http://www.virtualbluelot.com/Images/cod/2chick.jpg"
randomcontent[2]="http://www.virtualbluelot.com/Images/cod/3chick.jpg"
randomcontent[3]="http://www.virtualbluelot.com/Images/cod/4chick.jpg"
randomcontent[4]="http://www.virtualbluelot.com/Images/cod/5chick.jpg"
randomcontent[5]="http://www.virtualbluelot.com/Images/cod/6chick.jpg"
randomcontent[6]="http://www.virtualbluelot.com/Images/cod/7chick.jpg"
randomcontent[7]="http://www.virtualbluelot.com/Images/cod/8chick.jpg"
randomcontent[8]="http://www.virtualbluelot.com/Images/cod/9chick.jpg"


//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>
</a></td></table></div>

blm126
08-10-2006, 06:26 PM
that shouldn't work...You are supposed to set the iframe to point to an html page.Not an image.

alexjewell
08-10-2006, 06:29 PM
What you'll need to do:

Put the images into html files, or any type of file, really; php, asp, etc.

Link them within that file.

Then change the url's to those files.