Paullkha
asked on
Code works, but HOW?
<SCRIPT TYPE="text/javascript">
<!--
var downStrokeField;
function autojump(fieldName,nextFie ldName,fak eMaxLength )
{
var myForm=document.forms[docu ment.forms .length - 1];
var myField=myForm.elements[fi eldName];
myField.nextField=myForm.e lements[ne xtFieldNam e];
if (myField.maxLength == null)
myField.maxLength=fakeMaxL ength;
myField.onkeydown=autojump _keyDown;
myField.onkeyup=autojump_k eyUp;
}
function autojump_keyDown()
{
this.beforeLength=this.val ue.length;
downStrokeField=this;
}
function autojump_keyUp()
{
if (
(this == downStrokeField) &&
(this.value.length > this.beforeLength) &&
(this.value.length >= this.maxLength)
)
this.nextField.focus();
downStrokeField=null;
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<P>Place content here.</P>
<FORM ACTION="../cgi-bin/mycgi.p l" METHOD=POST>
SSN:
<INPUT TYPE=TEXT NAME="ssn_1" MAXLENGTH=3 SIZE=3> -
<INPUT TYPE=TEXT NAME="ssn_2" MAXLENGTH=2 SIZE=2> -
<INPUT TYPE=TEXT NAME="ssn_3" MAXLENGTH=4 SIZE=4><BR>
email: <INPUT TYPE=TEXT NAME="email"><BR>
</FORM>
<SCRIPT TYPE="text/javascript">
<!--
autojump('ssn_1', 'ssn_2', 3);
autojump('ssn_2', 'ssn_3', 2);
autojump('ssn_3', 'email', 4);
//-->
</SCRIPT>
</BODY>
</HTML>
There are no events on the input boxes? When, or how, is function autojump being called?
I could understand this
<INPUT TYPE=TEXT NAME="ssn_2" MAXLENGTH=2 SIZE=2 onkeypress"(autojump...)">
<!--
var downStrokeField;
function autojump(fieldName,nextFie
{
var myForm=document.forms[docu
var myField=myForm.elements[fi
myField.nextField=myForm.e
if (myField.maxLength == null)
myField.maxLength=fakeMaxL
myField.onkeydown=autojump
myField.onkeyup=autojump_k
}
function autojump_keyDown()
{
this.beforeLength=this.val
downStrokeField=this;
}
function autojump_keyUp()
{
if (
(this == downStrokeField) &&
(this.value.length > this.beforeLength) &&
(this.value.length >= this.maxLength)
)
this.nextField.focus();
downStrokeField=null;
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<P>Place content here.</P>
<FORM ACTION="../cgi-bin/mycgi.p
SSN:
<INPUT TYPE=TEXT NAME="ssn_1" MAXLENGTH=3 SIZE=3> -
<INPUT TYPE=TEXT NAME="ssn_2" MAXLENGTH=2 SIZE=2> -
<INPUT TYPE=TEXT NAME="ssn_3" MAXLENGTH=4 SIZE=4><BR>
email: <INPUT TYPE=TEXT NAME="email"><BR>
</FORM>
<SCRIPT TYPE="text/javascript">
<!--
autojump('ssn_1', 'ssn_2', 3);
autojump('ssn_2', 'ssn_3', 2);
autojump('ssn_3', 'email', 4);
//-->
</SCRIPT>
</BODY>
</HTML>
There are no events on the input boxes? When, or how, is function autojump being called?
I could understand this
<INPUT TYPE=TEXT NAME="ssn_2" MAXLENGTH=2 SIZE=2 onkeypress"(autojump...)">
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
oops, sorry knightEknight, looks like you were quicker on the trigger.
we are both right :)
ASKER
Damn, see it now, kewl thx
ASKER
In other words, the code is their, but not within view source. (Like C++ handlers)