Thread: AJAX Problem
View Single Post
08-18-2007, 01:19 PM
#2
Choco is offline Choco
Status: Member
Join date: Jul 2007
Location: USA
Expertise:
Software:
 
Posts: 240
iTrader: 2 / 100%
 

Choco is on a distinguished road

Send a message via MSN to Choco

  Old

Originally Posted by Garrett View Post
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. =)