Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script>
- function z1()
- {
- tab=[];
- for (i=0; i<10;i++)
- tab[i]=Math.round(Math.random()*30+1);
- document.getElementById("wyswietl").innerHTML=tab;
- document.getElementById("wyswietl_pierwszy").innerHTML=tab[0];
- document.getElementById("wyswietl_ostatni").innerHTML=tab[9];
- }
- function z2()
- {
- tab=[];
- for (i=0; i<10;i++)
- tab[i]=Math.round(Math.random()*30+1);
- document.getElementById("w3").innerHTML = Math.min.apply(Math,tab) + "<br>";
- document.getElementById("w4").innerHTML += Math.max.apply(Math,tab);
- }
- </script>
- <body>
- <button onclick="z1()">Wyswietl</button>
- <p id="wyswietl"></p>
- <button onclick="z1()">Wyświetl pierwszy</button>
- <p id="wyswietl_pierwszy"></p>
- <button onclick="z1()">Wyświetl ostatni</button>
- <p id="wyswietl_ostatni"></p>
- <button onclick="z2()">Element minimalny</button>
- <p id="w3"></p>
- <button onclick="z2()">Element maksymalny</button>
- <p id="w4"></p>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement