Find jobs - iPhone Store - High Paying Adsense List - Debt Consolidation - Kamala Harris

PDA

View Full Version : 2 functions, not sure what way to do this ?


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.

Marty_
Aug 29th 2008, 2:28 am
Its ok, but thanks to those that might have thought of a solution, I figured out what to do... as before see my signature to the right and BTW if anyone is interested, I offer these audio ads on my home page for free, along with several other webmasters we play these ads to promote our services as demos

Marty_
Aug 29th 2008, 3:53 pm
I don't mean to bump threads, but as above I have my code selecting audio ads at random and if the ad "says" press a keyboard key that also works, but now I have a small problem.

I need to delay the document.write

This is what I have and works, without a delay
document.write(""+list[choice]+"");

How could I delay this action ?