-
Capture an Enter keypress, Fake a Tab keypress
Does anyone know how to implement a simple capture of enter and make the browser
think they pressed tab.
I tried:
If window.event.keycode = 13 Then
window.event.keycode = 9
End If
and had that called from a OnKeyPress. I know it gets there after throwing
in a MsgBox debug line. But I cannot figure out how to move the dern cursor.
I have a lot of input boxes created via ASP before the page is loaded and
I hoping to avoid using a setfocus kinda command.
Too bad SendKeys isn't available in DHTML.
Thanx for any help
-
Re: Capture an Enter keypress, Fake a Tab keypress
"TechnoSpaz" <Atom_Russell@hotmail.com> wrote in message
news:3c34ea38$1@147.208.176.211...
> I tried:
> If window.event.keycode = 13 Then
> window.event.keycode = 9
> End If
> and had that called from a OnKeyPress.
It might work if you try it from onkeydown instead of onkeypress.
-- Matthew Solnit
-
Re: Capture an Enter keypress, Fake a Tab keypress
"Matthew Solnit" <msolnit.spamsux.yahoo-com> wrote:
>"TechnoSpaz" <Atom_Russell@hotmail.com> wrote in message
>news:3c34ea38$1@147.208.176.211...
>> I tried:
>> If window.event.keycode = 13 Then
>> window.event.keycode = 9
>> End If
>> and had that called from a OnKeyPress.
>
>It might work if you try it from onkeydown instead of onkeypress.
>
>-- Matthew Solnit
>
>
I tried that as well, no luck. Thank you though.
-
Re: Capture an Enter keypress, Fake a Tab keypress
"TechnoSpaz" <Atom_Russell@hotmail.com> wrote:
>
>Does anyone know how to implement a simple capture of enter and make the
browser
>think they pressed tab.
>
>I tried:
>
> If window.event.keycode = 13 Then
> window.event.keycode = 9
> End If
I was able to trap the backspace key with the following JavaScript called
from the onKeyDown() event:
if ( event.keyCode == 8 )
{
}
-
Re: Capture an Enter keypress, Fake a Tab keypress
Here's some code I snagged from a web site the other day. I haven't done
anything but skim it and was going to figure out what it is doing but haven't
had the time. Just a guess, could help. If not, sorry.
function AutoTab( hItem, maxLength, linkItem ){
var vKeyCode,oItem
oItem = eval(linkItem);
vKeyCode = window.event.keyCode
if(vKeyCode==9 && window.event.shiftKey){ return; }
switch(window.event.keyCode){
case 37 : return;
case 39 : return;
case 16 : return;
case 46 : return;
}
if (window.event.keyCode != 9 ){
if( typeof(oItem) == "object" ){
if( (String(oItem.value).length == 0) && (String(hItem.value).length
== maxLength) ){
oItem.focus()
}
}
}
}
"TheGuy" <d@d.org> wrote:
>
>"TechnoSpaz" <Atom_Russell@hotmail.com> wrote:
>>
>>Does anyone know how to implement a simple capture of enter and make the
>browser
>>think they pressed tab.
>>
>>I tried:
>>
>> If window.event.keycode = 13 Then
>> window.event.keycode = 9
>> End If
>
>I was able to trap the backspace key with the following JavaScript called
>from the onKeyDown() event:
>
>if ( event.keyCode == 8 )
>{
>}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks