Friday, 31 January 2020

CRLF on Various Systems and Web Programming

Carriage Return (CR) and Line Feed (LF) are common character in computer programming. Different systems use them differently.

CRLF = 0D,0A = 13,10 = \r\n

New line on different systems:
  • Windows: \r\n
  • Mac: \r
  • Linux: \n
  • HTML textarea tag: \n
  • expect: \r
Check JavaScript event Enter key

HTML ('event' is lower case to work in Firefox):
<input onkeyup="check_enter(event);"/>

JS code:
function check_enter(Event){
  if (Event.keyCode==13)
    console.log("Enter key pressed");
}

No comments:

Post a Comment