Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> 2 dim array
dirtyhustlaz
post
Post #1





Grupa: Zarejestrowani
Postów: 22
Pomógł: 0
Dołączył: 29.03.2012

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


probouje napisac sktypy ktory z formularza zapisuje dwie informacje:
1. imie studenta
2. ocene studenta

ma to powtarzac 10 razy
a na koniec wyswietlic liste

moj skrypt nie pobiera wogole informacji z formularza, moze ktos mu wytknac bledy?

kod:
  1. <script type="text/javascript">
  2. var names = new Array();
  3.  
  4. var r=0;
  5. var c=0;
  6.  
  7. function registerPupil()
  8. {
  9. for(r=0;r<10;r++)
  10. {
  11. names[r]=new Array();
  12. for(c=0;c<2;c++)
  13. {
  14. if (c==0)
  15. {
  16. names[r][c]= document.getElementById('name').value;;
  17. }
  18. else
  19. {
  20. names[r][c]= document.getElementById('mark').value;
  21.  
  22. }
  23.  
  24. }
  25.  
  26. }
  27. }
  28.  
  29. function displayMarks()
  30. {
  31. for(r=0;r<3;r++)
  32. {
  33. document.write(names[r][0]);
  34. document.write(names[r][1]);
  35. document.write("<br>");
  36. }
  37. }
  38. </script>
  39.  
  40. <div id="registration">
  41. <label>PUPIL NAME: </label><input id="name" type="text">
  42. <label>MARK: </label><input id="mark" type="text">
  43. <button onClick="registerPupil()">Register</button>
  44. </div>


Ten post edytował dirtyhustlaz 28.05.2012, 13:13:26
Go to the top of the page
+Quote Post

Posty w temacie


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 - 13:48