Introduction
Get set up for the slideshow
// javascript variables that will be rotated in sequence by the programming code.
- <script>
- <!--
- // assign “n” a maximum number of image files to their javascript variable counterparts. The javascript variable is
- // “slide image” followed by a number ranging from 1 to the variable ‘number_of_images’ for each image file.
- var number_of_images = {“n” maximum number}
- var img_counter = 1
- var slideimage = new Array();
- while ( img_counter <= number_of_images )
- {
- slideimage[img_counter] = new Image()
- slideimage[img_counter].src = " imagefile "+img_counter+".jpg"
- img_counter++
- }
- //-->
- </script>
The images, (imagefile1.jpg, imagefile 2.jpg, imagefile 3.jpg, ….. imagefile n.jpg) are assigned in sequence to JavaScript image objects “slideimage[1], slideimage[2], slideimage[3], ….. slideimage[n]”.
- <script>
- <!--
- document.write("<img src= eval('slideimage[1].src') name='genericname' id='generic_id' width=220
- height=140>");
- // set the slide counter to 2 since the first one is already displayed.
- var kounter = 2
- // set the opacity variable to 0.25 as an initial starting point for the
- // image’s displayed opacity.
- var opac = 0.25
- // begin javascript function “generic_javascript_function”.
- function generic_javascript_function() {
- // fetch the type of browser.
- browser_type = navigator.appName;
- // if the type of browser is the older Microsoft Internet
- // Explorer (before IE 11), then process the code in this
- // if-endif structure.
- if (browser_type == "Microsoft Internet Explorer") {
- // use MSIE blendTrans with a 1 second duration.
- document.images.genericname.style.filter="blendTrans(duration=1)"
- // use MSIE blendTrans with a 2 second duration.
- document.images.genericname.style.filter="blendTrans(duration=2)"
- // use MSIE blendTrans to apply the filter.
- document.images.genericname.filters.blendTrans.Apply()
- // update the display with whatever the current image is.
- document.images.genericname.src=eval("slideimage["+kounter+"].src")
- // use MSIE blendTrans to play the filter.
- document.images.genericname.filters.blendTrans.Play()
- // if the slide counter variable is less than ‘number_of_images’, then
- // move to the next image in the sequence.
- if ( kounter <= number_of_images ) {
- kounter++
- }
- // if the slide counter variable equals ‘number_of_images’, then set it
- // to wrap around to the first image in the sequence.
- if ( kounter > number_of_images ) {
- kounter = 1
- }
- // display the image for 4 seconds.
- setTimeout("generic_javascript_function()", 4000)
- }
- // if the type of browser is not the older Microsoft Internet
- // Explorer (before IE11), then process the code in this
- // if-endif structure.
- if (browser_type != "Microsoft Internet Explorer") {
- // adjust the image to the current opacity setting.
- document.getElementById('generic_id').style.opacity = opac
- // update the display with whatever the current image is. this can
- // either be the same image or the next one in sequence if the opacity
- // of the previous one has exceeded the value of 1.0.
- document.images.genericname.src= eval("slideimage["+kounter+"].src")
- // increment the opacity variable by 0.25 so the current
- // image is less opaque.
- opac = opac + 0.25
- // if the opacity variable is greater than 1.0, the least opaque value,
- // then process the code in this if-endif structure.
- if (opac > 1.0) {
- // set the opacity variable back to 0.25, the most opaque setting used.
- opac = 0.25
- // if the slide counter variable is less than ‘number_of_images’, then
- // move to the next image in sequence.
- if ( kounter <= number_of_images ) {
- kounter++
- }
- // if the slide counter variable equals ‘number_of_images’, then set it
- // to wrap around to the first image in the sequence.
- if ( kounter > number_of_images ) {
- kounter = 1
- }
- }
- // display the image for 1 second.
- setTimeout("generic_javascript_function()", 1000)
- }
- // end javascript function “generic_javascript_function”.
- }
- // call the javascript “generic_javascript_function” function to create an infinite loop
- // to perpetuate the slideshow.
- generic_javascript_function()
- //-->
- </script>

Douglas MillerPosted Jul 25, 2014, 10:46 PM
This javascript is coded into your web page and it will work with a set number of image files that will be rotated in sequence over and over. I use it on my site, http://www.analyzohiosoftware.com on multiple pages in the domain and it seems to work well - even on mobile devices.
Victor LawverPosted Jul 25, 2014, 5:27 AM
how to use this code?