PDA

View Full Version : Javascript Slideshow not working



groovy1
08-10-2010, 04:30 AM
Hi
Yet another query. I have added a slideshow to my site, the initial image is displaying, but the slideshow does not work.

Does anyone have suggestions?

thanks
groovy1



<script>
// (C) 2000 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this header
// NS4-6,IE4-6
// Fade effect only in IE; degrades gracefully

// =======================================
// set the following variables
// =======================================

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000

// Duration of crossfade (seconds)
var crossFadeDuration = 5

// Specify the image files
var Pic = new Array() // don't touch this
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = 'images/picture2.jpg'
Pic[1] = 'images/picture3.jpg'
Pic[2] = 'images/picture4.jpg'
Pic[3] = 'images/picture5.jpg'
Pic[4] = 'images/picture1.jpg'


// =======================================
// do not edit anything below this line
// =======================================

var t
var j = 0
var p = Pic.length

var preLoad = new Array()
for (i = 0; i < p; i++){
preLoad[i] = new Image()
preLoad[i].src = Pic[i]
}

function runSlideShow(){
if (document.all){
document.images.SlideShow.style.filter="blendTrans(duration=2)"
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
document.images.SlideShow.filters.blendTrans.Apply()
}
document.images.SlideShow.src = preLoad[j].src
if (document.all){
document.images.SlideShow.filters.blendTrans.Play()
}
j = j + 1
if (j > (p-1)) j=0
t = setTimeout('runSlideShow()', slideShowSpeed)
}
</script>
</head>

<body id="home">
<script language="JavaScript1.2">mmLoadMenus();</script>

<body onLoad="runSlideShow();">

<div id="Layer1">
<div id="Background">
<table width="875" height="581" border="0">
<tr>
<td width="190" rowspan="3"><div align="center"><img src="../Images/CentacareLogosml.jpg" alt="Centacare Logo" width="120" height="125" hspace="20" longdesc="../Images/CentacareLogo.jpg" /></div></td>
<td width="671" height="95"><div align="center" class="style5">Centacare</div></td>
</tr>
<tr>
<td height="27"><div align="center"><span class="style2">New England North West </span></div></td>
</tr>
<tr>
<td height="21">&nbsp;</td>
</tr>
<tr>
<td height="302"><div align="left">
<ul id="navlist">
<li class="home"><a href="index.html">Home</a></li>
<li class="aboutus"><a href="javascript:;" name="link3" id="link1" onmouseover="MM_showMenu(window.mm_menu_1008142321_0,145,-5,null,'link3')" onmouseout="MM_startTimeout();">About Us</a></li>
<li class="ourservices"><a href="javascript:;" name="link4" id="link1" onmouseover="MM_showMenu(window.mm_menu_1008142321_0,145,-5,null,'link4')" onmouseout="MM_startTimeout();">Our Services</a></li>
<li class="ourpartners"><a href="ourpartners.html">Our Partners</a></li>
<li class="news"><a href="news.html">News</a></li>
<li class="jobs"><a href="jobs.html">Jobs</a></li>
<li class="helpus"><a href="helpus.html">Help Us</a></li>
<li class="contactus"><a href="contactus.html">Contact Us</a></li>
</ul>
</div></td>

<td id="VU" height=300 width=400> <div align="center"><img src="../Images/picture1.jpg" name='SlideShow' width=400 height=300> </div></td>
</tr>
<tr>
<td height="122"><div align="center">

vwphillips
08-10-2010, 08:06 AM
you have two BODY tags, remove the first


<body id="home">
<script language="JavaScript1.2">mmLoadMenus();</script>

<body onLoad="runSlideShow();">

groovy1
08-10-2010, 08:37 AM
Hi Vic

When I delete the first body tag. this stops the popup navigation menu from working. and still doesn't make the slideshow work. The first image is displayed, but the next ones don't show.

thankyou for your help. do you have any other ideas?
Linda


</head>

<body id="home">
<script language="JavaScript1.2">mmLoadMenus();</script>

<body onLoad="runSlideShow();">

<div id="Layer1">
<div id="Background">
<table width="875" height="581" border="0">
<tr>

vwphillips
08-10-2010, 10:22 AM
post a link to your page

groovy1
08-10-2010, 10:50 AM
Hi Vic

here is the link
http://www.jlkbooks.com.au/Centacare/Website/index.html

currently the site is under construction. You will also notice that the menu items for "our services" and "about us" are also displaying the same information. I have 2 different menus for these but can't get the appropriate one to display on each correctly.

thanks for your assistance:)
Linda

Beverleyh
08-10-2010, 11:48 AM
It looks like the paths to your images are wrong.

In the array, your paths are 'images/picture2.jpg'
But your main image path is src="../Images/picture1.jpg"

Make sure your paths are correct (it might help to use absolute paths while testing) and also that you're not mixing uppercase and lowercase.

groovy1
08-10-2010, 12:13 PM
Hi Beverley

thankyou:):):)
perfect.
am I pushing my luck in asking if you know a solution to why on my navigation menu the 2 popup menus are not displaying correctly. All the information is there but only one of the menus is displaying in both tabs.

here is the link
http://www.jlkbooks.com.au/Centacare/Website/index.html

Thanks again:)
Linda

Beverleyh
08-10-2010, 12:56 PM
Hi Linda,

The quick answer is "yes, I do know why only one popup menu is showing".
It's because you have the same javascript pasted into your page twice and in both instances it's calling mm_menu_1008142321_0.writeMenus();
So, even though you have 2 batches of different category pages references in the script (one for each popup) both popups have the same number reference of 1008142321_0

My long-winded answer is that you should consider changing your menu altogether because the one you're using was written in 2002 and since then, much more robust/stable/attractive/easy-to-install menus have been developed. Its also a bad idea to use a menu that is solely generated via javascript - if a visitors has javascript turned off, they cant get to your sub-pages :(

I recommend changing your menu to one that uses HTML markup in the body of your web page with CSS to style and javascript thrown in for a few nice effects. A menu structured this way is also accessible to users without javascript enabled in their browsers.

This menu in the DD library looks like a good alternative:http://www.dynamicdrive.com/dynamicindex1/ddsmoothmenu.htm but if you want more variety, have a look at the full list here: http://www.dynamicdrive.com/dynamicindex1/indexc.html

If you need any installation help for a new menu (personally, I'd go for this one: http://www.dynamicdrive.com/dynamicindex1/ddsmoothmenu.htm ), let us know.

Hope that helps

groovy1
08-10-2010, 08:31 PM
thanks Beverley for your advice

I will try out one of the other menus.

Linda:)

azoomer
08-10-2010, 08:44 PM
Beverlyh !
The smoothmenu does not work with javascript disabled, whereas a menu like the superfish (http://users.tpg.com.au/j_birch/plugins/superfish/#examples) does. But I agree that the smooth menu is more slick with the slideup effect and all