Entry
why ENTER KEY does not post a page when i querystring a page ...! but it works fine when i submit
Apr 7th, 2008 23:05
ha mo, Ky Dang, Jean-Bernard Valentaten, SK RK,
Well, it really depends on which method you use to submit the page and
how you build your querystring.
If you use the GET method (e.g. <form action="..." method="GET" ...>),
the browser will build a querystring that is escaped (URI-encoded that
is), attaches the querystring to the webpages' name (separated by a
question mark) and then calls that address (e.g.
http://www.yourURL.com?p=1&n=2). Since a querystring is plaintext,
some characters might not be transported very well or might get parsed
out by the web-server, so they need to be URI-encoded. JavaScript 1.5
has a method called encodeURI(), previous versions had a method called
escape() to achieve that (you'll find plenty of information on bboth
methods by searching the web *g*).
If you use the POST metjod (e.g. <form action="..."
method="POST" ...>), the browser will open a special connection to the
web-server and transmits the data through it (this works like a remote
procedure call), so you won't be able to achieve that by using
JavaScript (since js is not capable of controlling sockets).
HTH,
Jean
-----------------------------------------------------------
Entry: November 10, 2020
Try to trap the enterKey (code=13) an call the submit for the form.
(I have not tested this so let me know if it does not work for you.)
function enterKeyTrap()
{
if (window.event.keyCode == 13)
{
document.myForm.submit();
}
}
<form name="myForm" onkeyup="enterKeyTrap();">
<input type="submit" value="Go" name="B1">
</form>
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com