having a problem with the number one browser for downloading another browser...IE
IE8 fails to submit when you开发者_如何学运维 hit enter in a form. here is what i use:
function submitOnEnter() {
if (browserName=="Microsoft Internet Explorer")
{
var key;
if (window.event){
key = window.event.keyCode; //IE
}
if(key == 13){
document.forms['myform'].submit();
}
}
}
and this is located on the text input :
onkeyup="submitOnEnter()"
The form seems to submit when i press enter twice?? but not once.
Can you help?
Okay guys, i fixed it using....
<!-- Fix for IE bug (One text input and submit, disables submit on pressing "Enter") -->
<div style="display:none">
<input type="text" name="hiddenText"/>
</div>
Weird eh? Maybe this will work for some of you and not others. some solutions didnt work for me, this one did.
Submit works when pressing ENTER when there is a submit button present in the form <input type="submit">
. You can hide the button if you want. No need to intercept keystrokes.
My problem was that i checked for the submit button. But IE seems not to send the submits in the $_POST array. Adding a hidden field solved my problem.
精彩评论