Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Advancing Text Field Focus with the Period key besides TAB; IE vs firefox

Reply
Thread Tools

Advancing Text Field Focus with the Period key besides TAB; IE vs firefox

 
 
henrywuxg@gmail.com
Guest
Posts: n/a
 
      11-21-2006
Hi All,

I would like to use Period Key(.) besides Tab to toggle from one
textbox to another when user is editing IP addresses, which have four
textboxes. The function in below works fine with IE5, but it has
strange problem with Firefox 1.5.0.8.

<!--
<td>IP Address
<input type="text" size="3" maxlength="3" name="ip_1"
onkeypress="return focusNext(this.form,'ip_2',event)">.
<input type="text" size="3" maxlength="3" name="ip_2"
onkeypress="return focusNext(this.form,'ip_3',event)">.
<input type="text" size="3" maxlength="3" name="ip_3"
onkeypress="return focusNext(this.form,'ip_4',event)">.
<input type="text" size="3" maxlength="3" name="ip_4"
onkeypress="return focusNext(this.form,'ip_4',event)">
</td>
-->

function focusNext(form, elemName, evt)
{
evt = (evt) ? evt : event;
var charCode = (evt.charCode) ? evt.charCode : ((evt.which) ?
evt.which : evt.keyCode);
if (charCode == 46) {
form.elements[elemName].focus( );
return false;
}
return true;
}
// source from <<Javascript and DHTML Cookbook>>

If you try with Firefox, besides focusing to next textbox, the period
is wrongly kept in previous one.

Thanks for any help

Henry

 
Reply With Quote
 
 
 
 
ASM
Guest
Posts: n/a
 
      11-21-2006
a écrit :
> Hi All,
>
> I would like to use Period Key(.) besides Tab to toggle from one
> textbox to another when user is editing IP addresses, which have four
> textboxes. The function in below works fine with IE5, but it has
> strange problem with Firefox 1.5.0.8.


no problemo with Firefox 2 (on Mac)

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
 
Reply With Quote
 
 
 
 
henrywuxg@gmail.com
Guest
Posts: n/a
 
      11-22-2006

ASM wrote:
> a écrit :
> > Hi All,
> >
> > I would like to use Period Key(.) besides Tab to toggle from one
> > textbox to another when user is editing IP addresses, which have four
> > textboxes. The function in below works fine with IE5, but it has
> > strange problem with Firefox 1.5.0.8.

>
> no problemo with Firefox 2 (on Mac)
>


Thanks.
Does anyone have the same on Firefox 1.5 on window?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
this.window.focus() vs. window.focus() vs. this.focus() Roger Javascript 3 03-08-2007 08:53 PM
VoIPCheap/Stunt/SIPDiscount/Et.al - Mobile - Top-up Expiry Period -- Campaign for Correct Expiry Period on Finarea VOIP Service Mobile Top-Ups News Reader UK VOIP 16 06-26-2006 05:03 PM
Ridiculous readInt() bug? Read-head not advancing far enough? nobrow@eircom.net Java 17 04-15-2005 10:12 AM
PC date/time randomly advancing notme Computer Support 1 02-11-2005 08:35 PM
advancing with the asp:datagrid Tim Smith ASP .Net 1 11-25-2003 07:51 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57