Solved

'Document Gallery' Script to loop through Word or HTML Documents

Posted on 2007-03-27
1
184 Views
Last Modified: 2010-04-16
I have a folder that has 25 documents in it.  (I can have them as Word, or HTML)  

I need a script/code that will act just like an image gallery would work, but it would display each file, online for a specified amount of time, then go to the next.  

I would like this to loop indefinitely.  

JavaScript or ASP would be best for me....I have no experience with Perl.  

Thanks!!!
0
Comment
Question by:tmhechler
1 Comment
 
LVL 1

Accepted Solution

by:
veiko_1001 earned 500 total points
ID: 18806822
To display the pages online, it would be best if you use HTML. Create an <IFRAME> on your page where you will load the content, start with a blank page:

<iframe id="myContent"></iframe>

Then you can create a loop function to load the page in Javascript which you can call periodically by using setInterval():

<script>

// set up list of images
var pagesArray = new Array()
pagesArray [0]="page1.html";
pagesArray [1]="page2.html";
pagesArray [2]="page3.html";

// start counter
var x = 0;

function loadNewPage()  {

// load image
document.getElementById("myContent").src = pagesArray[x]

// increment counter
x++;

// when at the end, start again
if(x==pagesArray.length) x=0;

}

</script>

And add the following code to the body tag:

<body onload="javascript: setInterval('loadNewPage()',5000);">

where 5000 is the time between the calls to the function in ms (In this case, 5 seconds).


Hope this helps...
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now