PDA

View Full Version : center or align in random iframe



ejmo
08-03-2009, 09:10 AM
1) Script Title: random iframe

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

3) I cannot get the random images to center.

I have tried most of the common controls, align, valign, hspace=, vspace=, etc. but they still show in the same place. I can control the spacing but the images I am using are of different sizes so I want to center all of them. I am sure it needs to be set in var iframeprops= but I cannot work out how to do it. Are the properties limited or restricted in some way as bgcolor does not work either? Any ideas?

Cheers, ejmo

ddadmin
08-03-2009, 10:05 PM
The script simply outputs a regular IFRAME, so whatever method works in centering a regular IFRAME should work here. Perhaps not best practice, though I noticed the "center" tag when added to the output works:


document.write('<center><iframe id="dynstuff" src="" '+iframeprops+' style="width:130; height=130; margin:0 auto;"></iframe></center>')

ejmo
08-04-2009, 08:41 AM
The script simply outputs a regular IFRAME, so whatever method works in centering a regular IFRAME should work here. Perhaps not best practice, though I noticed the "center" tag when added to the output works:


document.write('<center><iframe id="dynstuff" src="" '+iframeprops+' style="width:130; height=130; margin:0 auto;"></iframe></center>')



Hi, thanks for the help but it does not work. Have a look at this iframe

http://s179523124.websitehome.co.uk/x/gadgets/slideshowtest.html

the pics remain to the left no matter what I try.

Cheers, Phil.

ejmo
08-04-2009, 08:54 AM
I have just noticed that I can change the size of the frame, the frameborder and scrolling. All of these are external properties. How do I control the content of the frame? This will allow the pics to be centered.

Cheers, Phil.

ddadmin
08-04-2009, 07:42 PM
Are you talking about centering the contents within the IFRAME, and not the IFRAME itself relative to the page? For the former, instead of directly showing each image, it may be necessary to display each image as part of a page, in which each image is centered on that page. So you end up with something like:


randomcontent[0]="http://www.housepetsupply.com/Site-pics/page1.htm"
randomcontent[1]="http://www.crystalinks.com/page2.htm"
randomcontent[2]="http://pdftown.com/image/page3.htm"