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(
//zdjecia
'<img src="zdj1.jpg" width="281" height="255">',
'<img src="zdj7.jpg" width="281" height="255">'
).random().join(''));
// ]]>
</script>
// <![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(
//zdjecia
'<img src="zdj1.jpg" width="281" height="255">',
'<img src="zdj7.jpg" width="281" height="255">'
).random().join(''));
// ]]>
</script>
Jak mogę dołożyć do tego rotację żeby się zmieniały same a nie po odświeżeniu strony?