faqts : Computers : Programming : Languages : JavaScript : Frames

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

19 of 82 people (23%) answered Yes
Recently 2 of 10 people (20%) answered Yes

Entry

How can i resize iframe according to the contents of recordset?

Nov 14th, 2001 07:31
Peter Ritchie, Sumegha,


The size of your IFRAME (width and height) must be calculated from 
accessible values.  see 
http://www.faqts.com/knowledge_base/view.phtml/aid/12853 for an example 
of deciding the size based on the number of rows in a recordset.
If you cannot retrieve variable data (on the server) to decide how big 
your IFRAME will be; you can only size the IFRAME arbitrarily.
In the case of the contents of the IFRAME being a word document; 
assuming the client computer has word installed; you'd have to figure 
out a way to decide the size of a word document (width/height) based on 
all implementations of Word then write the javascript that will be 
executed in the browser.
I'm assuming your iFrame will be the contents of the results of a 
recordset.  In order to size the iframe appropriately to the results 
you want to display within it you need to decide how big that iframe 
will be before you create the HTML to format it.
So, in the contained page you need to perform some sort of database 
query to decide how big the resultset (to be viewed in iFrame is).  If 
it is a simple row set you can simply count the number of rows and 
format the iFrame like that.
Of course, your implementation will be drastically different and since 
I don't know how you're implementing it (php, asp, jsp, cgi, etc.) I 
can't give you a auspicious example.