🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.javascript
Article #46

Re: Jak wywołać metode submit formularza po nacisnięciu klawisza enter na jednym z jego pol

#46
From: Waldemar Thiel
Date: Thu, 27 Dec 2001 10:07
31 lines
1774 bytes
Witam

| W zasadzie całe pytanie jest juz zawarte w nagłówku Jak wywołać metodę
| submit formularza na stronie HTML kiedy użytkownik naciśnie enter na jednym
| z jego pól

Ponizej przyklad - chyba bedzie dzialac (przynajmniej w MSIE na 100%)...

<script language="JavaScript">
<!--
    function foo() {
        var form = document.forms.search;

        if (window.event.keyCode == 13) {
            form.submit()
        }
    }
//-->
</script>

<form name="blah" action="somepage.xxx" method="post">
    <input name="xxx" type="text" onkeypress="foo()">
</form>

Pozdrawiam,

-- 
Waldemar Thiel
waldemar.thiel@ce-market.com

*** There are no mistakes, just learning experience ***
Technical Details
Message-ID: <a0erq5$ke8$1@news.tpi.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!warszawa.rmf.pl!newsfeed.tpinternet.pl!news.tpi.pl!not-for-mail
References: <a0el0a$481$1@news.tpi.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!warszawa.rmf.pl!newsfeed.tpinternet.pl!news.tpi.pl!not-for-mail
From: "Waldemar Thiel" <waldemar.thiel@ce-market.com>
Newsgroups: pl.comp.lang.javascript
Subject: Re: Jak wywołać metode submit formularza po
 nacisnięciu klawisza enter na jednym z jego pol
Date: Thu, 27 Dec 2001 11:07:01 +0100
Organization: tp.internet - http://www.tpi.pl/
Lines: 104
Message-ID: <a0erq5$ke8$1@news.tpi.pl>
References: <a0el0a$481$1@news.tpi.pl>
NNTP-Posting-Host: hermes.ce-market.com
Mime-Version: 1.0
X-Trace: news.tpi.pl 1009447557 20936 195.116.250.42 (27 Dec 2001 10:05:57 GMT)
X-Complaints-To: usenet@tpi.pl
NNTP-Posting-Date: Thu, 27 Dec 2001 10:05:57 +0000 (UTC)
X-MSOESRec: 797374-20011242710 7 1653-00820101005800320074
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MSMail-Priority: Normal
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit