Home > front end >  Excuse me: function handleEnter {(field, the event) in the field?
Excuse me: function handleEnter {(field, the event) in the field?

Time:11-03

The following code:

The function handleEnter (field, the event) {
Var keyCode= event. KeyCode? Event. KeyCode: event. Which? Event. Which: event. CharCode;
If (keyCode==13) {
Var I;
For (I=0; I & lt; Field, the form elements. Length; I++)
If (field==field. Form. Elements [I])
break;
I=(I + 1) % field. The form. Elements. Length;
Event. The preventDefault ();
Field, form elements [I]. Focus ();
return false;
}
The else
return true;
}

Excuse me:
1, what is that field?
2, event. KeyCode? Event. KeyCode: event. Which? Event. Which: event. CharCode; What is the meaning of ?

CodePudding user response:

1 field is parameters, specific what is it, to see your incoming outside what arguments,
2 event is an event object, event. The keyCode is corresponding to the ASCII keyboard events of buttons,
Event. The keyCode? Event. KeyCode: event. Which? Event. Which: event. CharCode; Is three unary, if? Question mark in front of the expressions established, then take a colon: former values, or take a colon: after values,
Var keyCode= event. The keyCode ? event. The keyCode : (event. Which? Event. Which: event. CharCode) ;
Is red, blue value, otherwise take green value (including the value of the green is a ternary operators, spread out the green value according to the three unary)
Is equivalent to the following if the else
Var keyCode.
If (event. KeyCode) {
KeyCode=event. KeyCode;
{} else if (event which)
KeyCode=event. Which;
} else {
KeyCode=event. CharCode;
}

CodePudding user response:

reference 1st floor qybao response:
1 field is parameters, specific what is it, to see your incoming outside what arguments,
2 event is an event object, event. The keyCode is corresponding to the ASCII keyboard events of buttons,
Event. The keyCode? Event. KeyCode: event. Which? Event. Which: event. CharCode; Is three unary, if? Question mark in front of the expressions established, then take a colon: former values, or take a colon: after values,
Var keyCode= event. The keyCode ? event. The keyCode : (event. Which? Event. Which: event. CharCode) ;
Is red, blue value, otherwise take green value (including the value of the green is a ternary operators, spread out the green value according to the three unary)
Is equivalent to the following if the else
Var keyCode.
If (event. KeyCode) {
KeyCode=event. KeyCode;
{} else if (event which)
KeyCode=event. Which;
} else {
KeyCode=event. CharCode;
}


Very thank you, I feel that I too lack of knowledge, excuse me I should see what kind of data, or should see what book, please recommend several books, thank you very much,

CodePudding user response:

Novice school, front, inside, after the first two on the left side menu:
HTML/CSS=& gt; Learn the item 1, 3
Javascript=& gt; Learn the first item

Some basic behind you what to learn, in the mind will have an estimated

CodePudding user response:

refer to the second floor eisldkw response:
thanks very much, I feel my knowledge is too scarce, excuse me I should see what kind of data, or should see what book, please recommend several books, thank you very much,

Looking for the entry-level tutorial to learn first, these are the most basic knowledge, it is very important to lay a solid foundation
  • Related