Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Łączenie skryptów, Łączenie skryptów
kreskakropka
post
Post #1





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 15.12.2010

Ostrzeżenie: (0%)
-----


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>
Go to the top of the page
+Quote Post

Posty w temacie
- kreskakropka   Łączenie skryptów   15.12.2010, 12:39:43


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 21:48