faqts : Computers : Programming : Languages : JavaScript : DHTML

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

5 of 8 people (63%) answered Yes
Recently 1 of 3 people (33%) answered Yes

Entry

Working locally with HTA is it possible to print all the htm documents in a particular folder?

Apr 28th, 2001 23:09
Colin Fraser, Richard Brennan, Netscape JavaScript Guide


Not that I am aware of, not unless you have placed all the documents 
into a frameset then you can do something like :
 <script language="JavaScript"><!--
// This script uses the frames length and places 
// a 10 second delay between print execution
 function printAllFrames() {
     	for (var i=0;i<frames.length;i++)
         	if (window.print)
             		setTimeout('frames[i].print()',10000 * i);
 	}
 //--></script>
 </head>
 <frameset onLoad="printAllFrames()" cols="*,*,*">
 <frame src="page1.html">
 <frame src="page2.html">
 <frame src="page3.html">
 </frameset>
 </html>
This script allows you to set the number of pages you want to see, but 
the real problem is that there is no flexibility. You have to hard code 
the names of the pages in, increasing the number of columns to suit the 
particular folder. 
I am not sure this will work, I will not test it, but feel free to try 
it yourself.  I am not sure if the frames array works as it is set up 
here, it should, but I just dont know if the frames in a defined 
frameset can be referenced this way. If this does not work then it may 
be that the frames are not set in an array, but are individually named 
eg frame1.print, frame2.print and so on. If this is the case then the 
array is nonexistant and the setTimeout statement becomes a nonsense. If 
this is so then you may want to try (frames['+i+'].print()'...)
One word of caution, dont destroy a forest by printing like this.