Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JS Bin</title>
  6. </head>
  7. <body>
  8.  
  9. <input type = "button" value="zadanie"
  10. onclick="Zadanie1(array,array2,tablicFun);">
  11. <input type = "button" value="zadanie2"
  12. onclick="Zadanie2(array,array2,laczwwspolrzedne);">
  13.  
  14. <input type = "button" value="zadanie3" onclick="zadanie4(3,5);">
  15. <input type = "button" value="zadanie4" onclick="zad6();">
  16.  
  17. </body>
  18. </html>
  19.  
  20. <script>
  21.  
  22. var array=[4, 5, 6];
  23. var array2=[10, 20, 30];
  24.  
  25.  
  26. function Zadanie1(ar,ar2,z)
  27. {
  28. z(ar,ar2);
  29. }
  30.  
  31. function tablicFun(ar,ar2)
  32. {
  33. for(i=0;i<array.length;i++)
  34. {
  35. document.write(array[i]+array2[i]+"<br>");
  36. }
  37. }
  38.  
  39.  
  40. function Zadanie2(ar,ar2,z)
  41. {
  42. var zew = new Array(ar.length);
  43. zew=z(ar,ar2);
  44.  
  45. for(i=0;i<zew.length;i++)
  46. {
  47. document.write(zew[i].x+":"+zew[i].y+"<br>");
  48. }
  49. }
  50.  
  51. function laczwwspolrzedne(ar,ar2)
  52. {
  53. var objt = new Array(ar.length);
  54.  
  55. for(i=0;i<ar.length;i++)
  56. {
  57. objt.x = ar[i];
  58. objt.y = ar2[i];
  59.  
  60. document.write(objt.x+":"+objt.y+"<br>");
  61.  
  62. }
  63. return objt;
  64. }
  65.  
  66.  
  67. function zadanie4(p,e)
  68. {
  69. for(i=p;i<=e+1;i++)
  70. {
  71. document.write(second()+"<br>");
  72. }
  73. function second()
  74. {
  75. if(i>e)
  76. {
  77. return number.NaN;
  78. }
  79. return i;
  80. }
  81. }
  82.  
  83. function zad6()
  84. {
  85. var objekt = new Objekt();
  86. objekt.isExist(1);
  87.  
  88.  
  89. }
  90.  
  91.  
  92. function Objekt()
  93. {
  94. this.Liczby = [4, 5, 6];
  95.  
  96. this.Show = function()
  97. {
  98. for(i=0;i<this.Liczby.length;i++)
  99. {
  100. document.write(this.Liczby[i]+"<br>");
  101. }
  102. }
  103.  
  104. this.Remove = function (id)
  105. {
  106. this.Liczby.splice(id,1);
  107.  
  108. return 0;
  109. }
  110.  
  111. this.isExist = function (a)
  112. {
  113. for(i=0;i<this.Liczby.length;i++)
  114. {
  115. if(this.Liczby[i]==a)
  116. {
  117. document.write(a+" znajdeuje sie w tablicy");
  118. return 1;
  119. }
  120. }
  121. document.write(a+" nieznajduje sie w tablicy");
  122. return 0;
  123. }
  124.  
  125.  
  126. this.Add = function (a)
  127. {
  128. if(this.Liczby[this.Liczby.length]!=a)
  129. {
  130. this.Liczby.push(a);
  131. }
  132. return 0;
  133. }
  134. }
  135. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement