Marty_
Aug 28th 2008, 3:32 am
I have a list of mp3's that play randomly when my page opens.var list = new Array;
list[0] = "0.mp3";
list[1] = "1.mp3";
list[2] = "2.mp3";
list[3] = "3.mp3";
list[4] = "4.mp3";
list[5] = "5.mp3";
list[6] = "6.mp3";
list[7] = "7.mp3";
list[8] = "8.mp3";
list[9] = "9.mp3";
list[10] = "10.mp3";
list[11] = "11.mp3";
list[12] = "12.mp3";
list[13] = "13.mp3";
list[14] = "14.mp3";
list[15] = "15.mp3";
list[16] = "16.mp3";
var choice = Math.floor(Math.random() * list.length);
document.write("<embed src='demo_adverts/"+list[choice]+"' autostart='true' height='0' width='0'>");
Which works fine... I also have a separate function that opens a new window to a preset URL
<script src="demo_adverts/shortcut.js" type="text/javascript" ></script>
<script type="text/javascript">
shortcut("1",function() {
window.open('http://someUrl.com');
},{
'type':'keydown',
'propagate':false,
'target':document
} );
</script>
<script src="demo_adverts/shortcut.js" type="text/javascript" ></script>
<script type="text/javascript">
shortcut("2",function() {
window.open('http://www.someUrl.com/');
},{
'type':'keydown',
'propagate':false,
'target':document
} );
</script>
</body>
<script type="text/javascript" src="script/ieupdate.js"></script>
Which again works fine...
My question now is, how could I attached a URL the list so that for example when mp3 10 plays the "+list[choice]+" function could also pull a URL
... and with that dilemma how would I write the window.open('"+list[choice]+"'); part ?
Not all the mp3's have the instructions to press a key. To better understand what I'm trying to achieve see my signature to the right.
list[0] = "0.mp3";
list[1] = "1.mp3";
list[2] = "2.mp3";
list[3] = "3.mp3";
list[4] = "4.mp3";
list[5] = "5.mp3";
list[6] = "6.mp3";
list[7] = "7.mp3";
list[8] = "8.mp3";
list[9] = "9.mp3";
list[10] = "10.mp3";
list[11] = "11.mp3";
list[12] = "12.mp3";
list[13] = "13.mp3";
list[14] = "14.mp3";
list[15] = "15.mp3";
list[16] = "16.mp3";
var choice = Math.floor(Math.random() * list.length);
document.write("<embed src='demo_adverts/"+list[choice]+"' autostart='true' height='0' width='0'>");
Which works fine... I also have a separate function that opens a new window to a preset URL
<script src="demo_adverts/shortcut.js" type="text/javascript" ></script>
<script type="text/javascript">
shortcut("1",function() {
window.open('http://someUrl.com');
},{
'type':'keydown',
'propagate':false,
'target':document
} );
</script>
<script src="demo_adverts/shortcut.js" type="text/javascript" ></script>
<script type="text/javascript">
shortcut("2",function() {
window.open('http://www.someUrl.com/');
},{
'type':'keydown',
'propagate':false,
'target':document
} );
</script>
</body>
<script type="text/javascript" src="script/ieupdate.js"></script>
Which again works fine...
My question now is, how could I attached a URL the list so that for example when mp3 10 plays the "+list[choice]+" function could also pull a URL
... and with that dilemma how would I write the window.open('"+list[choice]+"'); part ?
Not all the mp3's have the instructions to press a key. To better understand what I'm trying to achieve see my signature to the right.