65.9K
CodeProject is changing. Read more.
Home

Slide Show - New, Improved

starIconstarIcon
emptyStarIcon
starIcon
emptyStarIconemptyStarIcon

2.50/5 (6 votes)

Mar 22, 2003

2 min read

viewsIcon

116762

downloadIcon

1628

Mimics PowerPoint functionality & can be used for short text messages

Sample Image - newss.jpg

Introduction

Nothing beats Powerpoint when it comes to presentations, right? The new Slide Show utility (check the older Slide Show[^]) attempts to mimic the same functionality for short text messages, minus all the fireworks, using JavaScript.

So what's new?

In the earlier version, I had used Frames ( now Div tag is used ) and you had to click on the buttons to move back and forth. Now the slides can be made to run automatically. The Show restarts once we come to the end of the Slide list. Moreover you can choose from a dynamic list of external JavaScript files, each of which may contain content on different topics.

Source code

The zipped source code file consists of -

  1. settings.aspx
  2. show.aspx
  3. sample .js files

How it works

You will need the .NET Framework to run the app.

The Setting.aspx dynamically picks up all the JS files in a specified folder and populates them into the listBox. On choosing a particular option from the listbox, i.e. the name of a JS file, that JS file is loaded on the fly, into the Show.aspx page and the first slide which is derived from a string array in the JS file shows up.

Here is the code to hookup the external JS file from Settings.aspx to Show.aspx

<script> 
var quip = new Array();
document.write('<script LANGUAGE="JavaScript" 
SRC="js/<%=Request.Params("extfile")%>"><\/SCRIPT>');
</script>

In the Show.aspx page , the messages can be scrolled both forward and backward using the buttons or it could be set to self-run mode.

The text for each slide can be a small message and this will be stored into each element of the string array of each JS file. The array size can be of variable length and additional messages can be added anytime to the external JavaScript file.

All the JS files have the same array called quip defined and the index of the array is a global variable which is controlled by the functions in Show.aspx.

You can change the time interval between 2 slides by setting the value in window.setTimeOut. In the example, it has been set to 1 sec.

myTimer=window.setTimeout("automato()",1000)

Even image tags can be inserted into the array in place of a string and an image slide show can also be performed.

This code can be modifed to make it run in Classic ASP too. BTW, isn't Classic ASP an oxymoron?

References

Links