Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

Feedback: irt.org FAQ Knowledge Base Q682

Feedback on: irt.org FAQ Knowledge Base Q682

Sent by Ute on September 01, 2000 at 08:18:20: - feedback #1693

Worth:
Very worth reading

Comments:
This works fine, but how can I do it with 3 input fields?



Sent by gogo on Wednesday September 19, 2007 at 10:15:55 - feedback #5037

Worth:

Length:

Technical:

Comments:
//put this code any where between your <head> tags.

function addInputSubmitEvent(form, input) {
input.onkeydown = function(e) {
e = e || window.event;
if (e.keyCode == 13) {
form.submit();
return false;
}
};
}

window.onload = function() {
var forms = document.getElementsByTagName('form');

for (var i=0;i < forms.length;i++) {
var inputs = forms[i].getElementsByTagName('input');
var selects = forms[i].getElementsByTagName('select');

for (var j=0;j < inputs.length;j++)
addInputSubmitEvent(forms[i], inputs[j]);
for (var j=0;j < selects.length;j++)
addInputSubmitEvent(forms[i], selects[j]);
}
};

//<!-- Taken from: http://www.thefutureoftheweb.com/blog/submit-a-form-in-ie-with-enter
and improved a bit by http://useful.2ya.com -->




Sent by gogo on Wednesday September 19, 2007 at 10:18:43 - feedback #5038

Worth:

Length:

Technical:

Comments:
//put this code any where between your <head> tags.

function addInputSubmitEvent(form, input) {
input.onkeydown = function(e) {
e = e || window.event;
if (e.keyCode == 13) {
form.submit();
return false;
}
};
}

window.onload = function() {
var forms = document.getElementsByTagName('form');

for (var i=0;i < forms.length;i++) {
var inputs = forms[i].getElementsByTagName('input');
var selects = forms[i].getElementsByTagName('select');

for (var j=0;j < inputs.length;j++)
addInputSubmitEvent(forms[i], inputs[j]);
for (var j=0;j < selects.length;j++)
addInputSubmitEvent(forms[i], selects[j]);
}
};

//<!-- Taken from: http://www.thefutureoftheweb.com/blog/submit-a-form-in-ie-with-enter
and improved a bit by http://useful.2ya.com -->




©2018 Martin Webb