Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [JavaScript][HTML]formularz bez entera
elmozaur
post 15.10.2009, 09:30:58
Post #1





Grupa: Zarejestrowani
Postów: 518
Pomógł: 18
Dołączył: 21.07.2008

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


Witajcie.
standardowe formularze w HTMLu maja taka wlasciwosc, ze po nacisnieciu klawisza enter formularz jest wysylany.
Czy mozna ta 'funkcjonalnosc' wylaczyc (np za pomoca JS ?)
Go to the top of the page
+Quote Post
piotrooo89
post 15.10.2009, 09:35:26
Post #2


Newsman


Grupa: Moderatorzy
Postów: 4 005
Pomógł: 548
Dołączył: 7.04.2008
Skąd: Trzebinia/Kraków




ja kozystam z tego:

Kod
<script>
function blokuj(e)
{
     var key;

     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

     if(key == 13)
          return false;
     else
          return true;
}
</script>


i wywołanie:

  1. <form method="get" action="">
  2. <input type="text" name="text" onKeyPress="return blokuj(event)">
  3. </form>


--------------------
Go to the top of the page
+Quote Post
nmts
post 15.10.2009, 10:38:22
Post #3





Grupa: Zarejestrowani
Postów: 283
Pomógł: 34
Dołączył: 21.03.2008

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


  1. <form method="POST" action="java script:void();">
  2. <input type="text" value="" />
  3. <input type="submit" value="" onmouseup="this.form.action='test.php';"/>
  4. </form>


--------------------
Free Web Tools - narzędzia dla programistów, webdeveloperów i specjalistów seo...
Go to the top of the page
+Quote Post
elmozaur
post 15.10.2009, 11:34:56
Post #4





Grupa: Zarejestrowani
Postów: 518
Pomógł: 18
Dołączył: 21.07.2008

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


dziekuje
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: 18.07.2025 - 08:03