Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> formularz - javascript
cycofiasz
post 28.07.2008, 15:52:56
Post #1





Grupa: Zarejestrowani
Postów: 711
Pomógł: 127
Dołączył: 5.07.2008
Skąd: Łódź

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


Witam, zrobiłem taki skromny skrypt php do uploadu plików (mp3) i wszystko śmiga elegancko.

Chciałbym jednak urozmaicić go o taki kosmetyczny efekt, że po kliknięciu "Wyślij" pokazywał by się animowany gif w jakimś miejscu stronki podczas gdy plik upa się na serwer... Podobna rzecz jest przy dodawaniu filmów na youtube.

Za pewne chodzi tu o zdarzenie "onsubmit", ale zielony jestem w javascripcie...
Go to the top of the page
+Quote Post
skowron-line
post 28.07.2008, 16:45:29
Post #2





Grupa: Zarejestrowani
Postów: 4 340
Pomógł: 542
Dołączył: 15.01.2006
Skąd: Olsztyn/Warszawa

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


np.
  1. <form action="" method="" onsubmit="pokaz();">
  2. // twoje inputy
  3. <input type="submit" name="submit" id="submit">
  4. </form>
  5. <span id="loader" style="visibility:hidden"><img src="loader.gif" border="0"></span>


Kod JS.
  1. function pokaz() {
  2. document.getElementById( 'loader' ).style.visibility='visible';
  3. }

Pisane z palca


--------------------
I'm so fast that last night I turned off the light switch in my hotel room and was in bed before the room was dark - Muhammad Ali.
Peg jeżeli chcesz uprawiać sex to dzieci muszą wyjść, a jeżeli chcesz żeby był dobry ty też musisz wyjść - Al Bundy.

QueryBuilder, Mootools.net, bbcradio1::MistaJam
http://www.phpbench.com/
Go to the top of the page
+Quote Post
cycofiasz
post 28.07.2008, 16:59:32
Post #3





Grupa: Zarejestrowani
Postów: 711
Pomógł: 127
Dołączył: 5.07.2008
Skąd: Łódź

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


Brawa dla tego Pana, pełna profeska.

Jeszcze jedno: jak zrobić żeby po kliknięciu submit oprócz tego gifa pojawił się odmierzasz czasu (ile minęło sekund od kliknięcia).

Chodzi o to by można było to wrzucić do tego span'a pod obrazkiem gif o którym była mowa wyżej.

Ten post edytował cycofiasz 28.07.2008, 17:24:02
Go to the top of the page
+Quote Post
skowron-line
post 28.07.2008, 20:53:19
Post #4





Grupa: Zarejestrowani
Postów: 4 340
Pomógł: 542
Dołączył: 15.01.2006
Skąd: Olsztyn/Warszawa

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


  1. <script type="text/javascript">
  2. function pokaz() {
  3. document.getElementById( 'loader' ).style.visibility='visible';
  4. setInterval( timex(), 1000 );
  5. }
  6. var sek = 0;
  7. function timex() {
  8. document.getElementById( 'timeLoader' ).style.visibility='visible';
  9. document.getElementById( 'timeLoader' ).setHTML = sek;
  10. sek++;
  11. }
  12. <form action="" method="" onsubmit="pokaz();">
  13. // twoje inputy
  14. <input type="submit" name="submit" id="submit">
  15. </form>
  16. <span id="loader" style="visibility:hidden"><img src="loader.gif" border="0"></span>
  17. <span id="timeLoader" style="visibility:hidden;display:block;"></span>

Znów pisane z palca

Ten post edytował skowron-line 28.07.2008, 20:54:06


--------------------
I'm so fast that last night I turned off the light switch in my hotel room and was in bed before the room was dark - Muhammad Ali.
Peg jeżeli chcesz uprawiać sex to dzieci muszą wyjść, a jeżeli chcesz żeby był dobry ty też musisz wyjść - Al Bundy.

QueryBuilder, Mootools.net, bbcradio1::MistaJam
http://www.phpbench.com/
Go to the top of the page
+Quote Post
cycofiasz
post 28.07.2008, 22:40:41
Post #5





Grupa: Zarejestrowani
Postów: 711
Pomógł: 127
Dołączył: 5.07.2008
Skąd: Łódź

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


tym razem cuś mi nie działa sad.gif
Go to the top of the page
+Quote Post
skowron-line
post 29.07.2008, 08:07:50
Post #6





Grupa: Zarejestrowani
Postów: 4 340
Pomógł: 542
Dołączył: 15.01.2006
Skąd: Olsztyn/Warszawa

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


  1. <script type="text/javascript">
  2. function pokaz() {
  3. document.getElementById( 'loader' ).style.visibility='visible';
  4. setInterval( "timex();", 1000 );
  5. }
  6. var sek = 1;
  7. function timex() {
  8. document.getElementById( 'timeLoader' ).style.visibility='visible';
  9. document.getElementById( 'timeLoader' ).innerHTML = sek;
  10. sek++;
  11. }
  12. <form action="" method="" onsubmit="pokaz();">
  13. // twoje inputy
  14. <input type="submit" name="submit" id="submit">
  15. </form>
  16. <span id="loader" style="visibility:hidden"><img src="loader.gif" border="0"></span>
  17. <span id="timeLoader" style="visibility:hidden;display:block;"></span>

Pomyłeczka nie setHTML tylko innerHTML przywyczajenie do Mootools -a

Ten post edytował skowron-line 29.07.2008, 08:08:07


--------------------
I'm so fast that last night I turned off the light switch in my hotel room and was in bed before the room was dark - Muhammad Ali.
Peg jeżeli chcesz uprawiać sex to dzieci muszą wyjść, a jeżeli chcesz żeby był dobry ty też musisz wyjść - Al Bundy.

QueryBuilder, Mootools.net, bbcradio1::MistaJam
http://www.phpbench.com/
Go to the top of the page
+Quote Post
cycofiasz
post 29.07.2008, 11:26:43
Post #7





Grupa: Zarejestrowani
Postów: 711
Pomógł: 127
Dołączył: 5.07.2008
Skąd: Łódź

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


Dzięki, już działa. Może uda mi się jeszcze tutaj dowiedzieć jak zmienić więcej parametrów stylu css po kliknięciu? Jak trzeba rozdzielić te parametry?

np:
  1. document.getElementById( 'loader' ).style.visibility='visible';


i chciałbym jeszcze zmienić jednocześnie height='50px'
Go to the top of the page
+Quote Post
skowron-line
post 29.07.2008, 12:02:28
Post #8





Grupa: Zarejestrowani
Postów: 4 340
Pomógł: 542
Dołączył: 15.01.2006
Skąd: Olsztyn/Warszawa

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


  1. document.getElementById( 'loader' ).style.visibility='visible';
  2. document.getElementById( 'loader' ).style.height='50px';


--------------------
I'm so fast that last night I turned off the light switch in my hotel room and was in bed before the room was dark - Muhammad Ali.
Peg jeżeli chcesz uprawiać sex to dzieci muszą wyjść, a jeżeli chcesz żeby był dobry ty też musisz wyjść - Al Bundy.

QueryBuilder, Mootools.net, bbcradio1::MistaJam
http://www.phpbench.com/
Go to the top of the page
+Quote Post

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 Wersja Lo-Fi Aktualny czas: 19.07.2025 - 04:22