23-02-2011, 19:45
Kod:
<script type="text/javascript">
// <![CDATA[
Array.prototype.random = function(limit)
{
if (typeof limit == 'undefined' || limit < 0) limit = 1;
else if (!limit) limit = this.length;
for (var i = 0, source = this, target = new Array(), n = source.length; i < limit && n > 0; i++)
{
do { var index = Math.random(); } while (index == 1);
index = Math.floor(index * n);
target.push(source[index]);
source[index] = source[--n];
}
return target;
}
document.write(new Array(
// Tu wpisz kolejne elementy:
'Tekst 1',
'Tekst 2',
'Tekst 3'
).random().join(''));
// ]]>
</script>
Ale ja nie chce żeby wyświetlił mi się losowy LINK tylko FILM, tak jak na youtube uzywa się do tego kodu:
Kod:
<iframe title="YouTube video player" width="640" height="390" src="http://www.youtube.com/embed/Hsg92N9Tx8E" frameborder="0" allowfullscreen></iframe>
Więc pytanie jak to zrobić?