Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Jak zrobic allert w javascript
--Adamus--
post
Post #1





Goście







Witam jak zrobić allert w javascript zeby jak bede chcial wyslac
formularz i klikne wyslij to pokaże sie allert "Czy napewno chcesz wyslac ?" i butonny Tak i Nie

tak samo bym chcial bym z forma w <input type="reset" value="Wyzeruj > taka informacje czy chcesz wyzerowac i tak lub nie

Dziękuję prawie w ogole nie znam javascript
Go to the top of the page
+Quote Post
phpion
post
Post #2





Grupa: Moderatorzy
Postów: 6 072
Pomógł: 861
Dołączył: 10.12.2003
Skąd: Dąbrowa Górnicza




  1. <form onsubmit="return confirm('Czy na pewno chcesz wysłać formularz?');">

Resztę chyba sobie poradzisz sam dopisać (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)
Go to the top of the page
+Quote Post
--Adamus--
post
Post #3





Goście







no wlasnie tyle to ja umiem ;( ale nie potrafie zrobic tak lub anuluj
Go to the top of the page
+Quote Post
pawel123
post
Post #4





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 1.03.2008

Ostrzeżenie: (10%)
X----


Witam równiez nie znam sie na javascript i szukam takiego malutkiego skrypciuku (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg) z alertem
Go to the top of the page
+Quote Post
Sabistik
post
Post #5


Administrator wortalu


Grupa: Przyjaciele php.pl
Postów: 960
Pomógł: 39
Dołączył: 21.10.2003
Skąd: Kraków

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


Pewnie coś w rodzaju:
Kod
function taknie{
  var answer = confirm ("Czy na pewno chcesz wysłać formularz?'")
  if (answer) {
    document.myform.submit();
  }
}
</script>

Funkcje podepnij na onsubmit albo coś w tym stylu. Resztę znajdziesz w manualach.
Go to the top of the page
+Quote Post
pawel123
post
Post #6





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 1.03.2008

Ostrzeżenie: (10%)
X----


czy tak sie podpina ?

  1. onsubmit="return taknie(this);"


(IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)
Go to the top of the page
+Quote Post
hondek
post
Post #7





Grupa: Zarejestrowani
Postów: 355
Pomógł: 50
Dołączył: 20.08.2007
Skąd: Częstochowa

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


bez return:)
Go to the top of the page
+Quote Post
pawel123
post
Post #8





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 1.03.2008

Ostrzeżenie: (10%)
X----


hmm ale jest problem poniewaz dalem skrypt w <head>

  1. function taknie{
  2. var answer = confirm ("Czy na pewno chcesz wysłać formularz?'")
  3. if (answer) {
  4. document.myform.submit();
  5. }
  6. }


i w inpucie onsubmit="taknie(this);" to nic sie nie wyswietla
Go to the top of the page
+Quote Post
Maciekbjw
post
Post #9





Grupa: Zarejestrowani
Postów: 217
Pomógł: 23
Dołączył: 2.12.2007
Skąd: Warszawa

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


Kod
<form name="myform" action="" method="POST">
?


masz zdefiniowaną nazwe formularza?
Go to the top of the page
+Quote Post
phpion
post
Post #10





Grupa: Moderatorzy
Postów: 6 072
Pomógł: 861
Dołączył: 10.12.2003
Skąd: Dąbrowa Górnicza




Cytat(phpion @ 1.03.2008, 21:24:45 ) *
  1. <form onsubmit="return confirm('Czy na pewno chcesz wysłać formularz?');">

Resztę chyba sobie poradzisz sam dopisać (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)

Pozwoliłem zacytować sam siebie. Po co tak kombinujecie?
Go to the top of the page
+Quote Post
pawel123
post
Post #11





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 1.03.2008

Ostrzeżenie: (10%)
X----


niestety nie dziala moj imput tak wyglada

  1. <input name="ok" type="submit" onsubmit="return confirm('Czy na pewno chcesz wysłać formularz?'); value="Wyslij" />


i rowniez nie dziala
Go to the top of the page
+Quote Post
hondek
post
Post #12





Grupa: Zarejestrowani
Postów: 355
Pomógł: 50
Dołączył: 20.08.2007
Skąd: Częstochowa

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


moze wiec tak :
  1. function taknie() {
  2. var answer = confirm ("Czy na pewno chcesz wysłać formularz?'");
  3. if (answer) {
  4. document.myform.submit();
  5. }
  6. }
  7. </head>
  8. <form action="index.php" method="post" onsubmit="taknie()">
  9. <input type="submit" value="ok" />
  10. </form>
  11. </body>
  12. </html>
Go to the top of the page
+Quote Post
pawel123
post
Post #13





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 1.03.2008

Ostrzeżenie: (10%)
X----


honek skrypt dziala ale obojetnie czy nacisne wyslij czy anuluj to i tak wykona sie skrypt w formularzu
Go to the top of the page
+Quote Post
hondek
post
Post #14





Grupa: Zarejestrowani
Postów: 355
Pomógł: 50
Dołączył: 20.08.2007
Skąd: Częstochowa

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


faktycznie (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
  1. function taknie() {
  2. var answer = confirm ("Czy na pewno chcesz wysłać formularz?'");
  3. return answer;
  4. }
  5. </head>
  6. <form action="index.php" method="post" onsubmit="return taknie()">
  7. <input type="submit" value="ok" />
  8. </form>
  9. </body>
  10. </html>
Go to the top of the page
+Quote Post
pawel123
post
Post #15





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 1.03.2008

Ostrzeżenie: (10%)
X----


hondek dzieki serdecznie dziala (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 25.08.2025 - 15:17