Originally Posted by Garrett
I am using Prototype for an AJAX script I made, the only problem is I have to hit the submit button, I can't hit Enter..
Is there anyway, to find out how to make it when you hit enter it will do it?
I was thinking of doing an if like:
Code:
document.onkeypress = function(){
if(document.getElementById('FORMID').focus){
ajaxCall();
}
}
Only problem is that it doesn't say when and what key it will work on...
I can only show the project to a select few, as it's very close to me. I don't think I would need to show anyone for this though.
|
<script type="text/javascript">
x= "myFormId";
y=document.getElementById(x);
document.onkeydown = function(e) {
e=(e)?e:window.event;
k=e.keyCode;
if(k==13)
ajaxCall();
}
</script>
That should work. =)