Mam do zrobienia następujące rzeczy:
Losowanie 3 obrazków (losuje mi je)
*strona ma wyświetlać komunikaty w nowym małym oknie:
jeśli wylosuje każdy inny obrazek ma wypisywać: niestety nie udało ci się
jeśli wylosuje dwa identyczne obrazki: już prawie
jeśli wylosuje trzy takie same obrazki: Udało się.
<html>
<head>
<title> Losowy obrazek </title>
<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:
'<IMG SRC="a.gif" >',
'<IMG SRC="b.gif" >',
'<IMG SRC="c.gif" >',
'<IMG SRC="d.gif" >',
'<IMG SRC="e.gif" >',
'<IMG SRC="f.gif" >',
'<IMG SRC="g" >',
'<IMG SRC="h" >',
'<IMG SRC="i" >',
'<IMG SRC="j" >',
'<IMG SRC="k" >',
'<IMG SRC="l" >',
'<IMG SRC="m" >',
'<IMG SRC="n" >'
).random(1).join(''));
// ]]>
</script>
<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:
'<IMG SRC="a.gif" >',
'<IMG SRC="b.gif" >',
'<IMG SRC="c.gif" >',
'<IMG SRC="d.gif" >',
'<IMG SRC="e.gif" >',
'<IMG SRC="f.gif" >',
'<IMG SRC="g" >',
'<IMG SRC="h" >',
'<IMG SRC="i" >',
'<IMG SRC="j" >',
'<IMG SRC="k" >',
'<IMG SRC="l" >',
'<IMG SRC="m" >',
'<IMG SRC="n" >
).random(1).join(''));
// ]]>
</script>
<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:
'<IMG SRC="a.gif" >',
'<IMG SRC="b.gif" >',
'<IMG SRC="c.gif" >',
'<IMG SRC="d.gif" >',
'<IMG SRC="e.gif" >',
'<IMG SRC="f.gif" >',
'<IMG SRC="g" >',
'<IMG SRC="h" >',
'<IMG SRC="i" >',
'<IMG SRC="j" >',
'<IMG SRC="k" >',
'<IMG SRC="l" >',
'<IMG SRC="m" >',
'<IMG SRC="n" >
).random(1).join(''));
// ]]>
</script>
</body>
</html>