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

H

henrywuxg

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
 
A

ASM

(e-mail address removed) 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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top