Javascript help need please

Maveric169

The Voices Talk to Me
Joined
5 Dec 2002
Messages
1,148
For my active desktop I have 2 slideshow javascripts, one that changes the background every day and one that runs a slideshow of pics, porn and ect. Now here is the problem, no matter what I do I can't seem to get both slideshows to run indepndantly^sp of each other. I even tried putting one in as a remote (like the calendar) and that don't work either. If I leave both scripts in either one of the other takes control and runs both the background and the slideshow with the same set of pics, and not there own seperate pics. Please help, this is driving me nuts!

Here is the code I am trying to use:



<HTML>
<HEAD>
<TITLE>Active Desktop</TITLE>

<!--script for calendar-->

<script>
function exec (command) {
if (document.layers && navigator.javaEnabled()) {
window._command = command;
window.oldOnError = window.onerror;
window.onerror = function (err) {
if (err.indexOf ("User didn't grant") != -1) {
alert('command execution of ' + window._command +
' disallowed by user.');
return true;
}
else return false;
}
netscape.security.PrivilegeManager.enablePrivilege
('UniversalExecAccess');
java.lang.Runtime.getRuntime().exec(command);
window.onerror = window.oldOnError;
}
else if (document.all) {
window.oldOnError = window.onerror;
window._command = command;
window.onerror = function (err) {
if (err.indexOf('utomation') != -1) {
alert('command execution of ' + window._command +
' disallowed by user.');
return true;
}
else return false;
};
var wsh = new ActiveXObject('WScript.Shell');
if (wsh)
wsh.Run(command);
window.onerror = window.oldOnError;
}
}
</script>

<!-- This is the slideshow script-->

<script>


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

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000

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

// 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] = 'slide/01.jpg'
Pic[1] = 'slide/02.jpg'
Pic[2] = 'slide/03.jpg'
Pic[3] = 'slide/04.jpg'
Pic[4] = 'slide/05.jpg'
Pic[5] = 'slide/06.jpg'
Pic[6] = 'slide/07.jpg'
Pic[7] = 'slide/08.jpg'
Pic[8] = 'slide/09.jpg'
Pic[9] = 'slide/10.jpg'
Pic[10] = 'slide/11.jpg'
Pic[11] = 'slide/12.jpg'
Pic[12] = 'slide/13.jpg'
Pic[13] = 'slide/14.jpg'
Pic[14] = 'slide/15.jpg'
Pic[15] = 'slide/16.jpg'
Pic[16] = 'slide/17.jpg'
Pic[17] = 'slide/18.jpg'
Pic[18] = 'slide/19.jpg'
Pic[19] = 'slide/20.jpg'
Pic[20] = 'slide/21.jpg'
Pic[21] = 'slide/22.jpg'
Pic[22] = 'slide/23.jpg'
Pic[23] = 'slide/24.jpg'
Pic[24] = 'slide/25.jpg'
Pic[25] = 'slide/26.jpg'
Pic[26] = 'slide/27.jpg'
Pic[27] = 'slide/28.jpg'
Pic[28] = 'slide/29.jpg'
Pic[29] = 'slide/30.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 = new Image()
preLoad.src = Pic
}

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>

<!--This is the Background script-->

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
// (C) 2001 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this header

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

// Set speed (milliseconds)
var speed = 86400000

// 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] = 'Synthesis2.jpg'
Pic[1] = 'riftcanyonBG.jpg'
Pic[2] = 'eggleton1.jpg'
Pic[3] = 'espace.jpg'
Pic[4] = 'aliens.jpg'
Pic[5] = 'timeless.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 = new Image()
preLoad.src = Pic
}

function runBGSlideShow(){
if (document.body){
document.body.background = Pic[j];
j = j + 1
if (j > (p-1)) j=0
t = setTimeout('runBGSlideShow()', speed)
}
}
// End -->
</script>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD>

<BODY onload="runBGSlideShow(); runSlideShow()">


<table width="100%" border="0">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td align="right"><script src="calendar.js"></script></td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td width="6%"><a href="c:"><img src="file:///D|/ActiveDesktop/C.gif" alt="C Drive" width="37" height="37" border="0"></a></td>
<td width="75%"><font color="#FF0000">C: Boot Drive</font></td>
<td width="19%"><a href="http://www.ntfs.org/index.php"><img src="file:///D|/ActiveDesktop/NTFS.gif" width="174" height="48" border="0"></a></td>
</tr>
<tr>
<td><a href="d:"><img src="file:///D|/ActiveDesktop/Personal.gif" alt="Personal" width="37" height="37" border="0"></a></td>
<td><font color="#0000FF">D: Personal</font></td>
<td><a href="http://www.ntfs.org/forum/search.php?s=&action=getnew"><img src="file:///D|/ActiveDesktop/NTFSF.gif" width="174" height="48" border="0"></a></td>
</tr>
<tr>
<td><a href="E:"><img src="file:///D|/ActiveDesktop/Music.gif" alt="Pictures and Music" width="38" height="37" border="0"></a></td>
<td><font color="#00CC00">E: Music &amp; Pics</font></td>
<td><a href="http://www.eclipseforums.org/search.php?s=&action=getnew"><img src="file:///D|/ActiveDesktop/CLUB3G.gif" width="174" height="48" border="0"></a>
</td>
</tr>
</table>
<br>

<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td id="VU">
<img src="slide\01.jpg">
</td>
</tr>
</table>


</body>
</html>
 
The two sets of images are being referenced by an array of the same name.

Pic[0] = 'Synthesis2.jpg'
Pic[1] = 'riftcanyonBG.jpg'
Pic[2] = 'eggleton1.jpg'
Pic[3] = 'espace.jpg'
Pic[4] = 'aliens.jpg'
Pic[5] = 'timeless.jpg'

_________________

Pic[0] = 'slide/01.jpg'
Pic[1] = 'slide/02.jpg'
Pic[2] = 'slide/03.jpg'
Pic[3] = 'slide/04.jpg'
Pic[4] = 'slide/05.jpg'
Pic[5] = 'slide/06.jpg'

---------------------------
Make sure you keep your variable names different. If they overlap some strange things can happen. I just browsed over the scripts so there may be more variables like that.
 
Well I took your advice and changed the array names, but no joy, I even tried a different handing script for the background and as soon as the slide show gets added I loose the background.

Any other iedas?
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back