llizard
12-16-2007, 09:34 PM
(Here I am, once again jumping in the deep end and I don't even know where my water wings are, or how to put them on even if I had them. My knowledge of javascripting and programming is only enough to get myself in trouble.)
I'm trying to create a random array NOT using php but calling up files using SSI "include virtual".
<script type="text/javascript" language="javascript">
//Random Files
announcements = new Array(
'test.txt',
'test2.txt',
'test3.txt'
);
// Pick a random file from the list
rnd.today=new Date();
rnd.seed=rnd.today.getTime();
function rnd()
{
rnd.seed = (rnd.seed*9301+49297) % 233280;
return rnd.seed/(233280.0);
};
function rand(number)
{
return Math.ceil(rnd()*number);
};
document.write('<!--#include virtual="/commonfiles/' + announcements[rand(announcements.length)-1] + '" -->');
</script>
Not surprisingly, the document.write in the coding is throwing a "cannot complete this directive" error. Any idea if what I'm trying to do is even possible? (It is working just fine if I do not try to use SSI.)
I have searched as best I can here and by googling. I had hoped the following thread might have the answer but alas, I do not think so....
http://www.codingforums.com/showthread.php?t=105055
I'm trying to create a random array NOT using php but calling up files using SSI "include virtual".
<script type="text/javascript" language="javascript">
//Random Files
announcements = new Array(
'test.txt',
'test2.txt',
'test3.txt'
);
// Pick a random file from the list
rnd.today=new Date();
rnd.seed=rnd.today.getTime();
function rnd()
{
rnd.seed = (rnd.seed*9301+49297) % 233280;
return rnd.seed/(233280.0);
};
function rand(number)
{
return Math.ceil(rnd()*number);
};
document.write('<!--#include virtual="/commonfiles/' + announcements[rand(announcements.length)-1] + '" -->');
</script>
Not surprisingly, the document.write in the coding is throwing a "cannot complete this directive" error. Any idea if what I'm trying to do is even possible? (It is working just fine if I do not try to use SSI.)
I have searched as best I can here and by googling. I had hoped the following thread might have the answer but alas, I do not think so....
http://www.codingforums.com/showthread.php?t=105055