HTML | DOM KeyboardEvent keyCode Property Last Updated : 06 Jul, 2022 Comments Improve Suggest changes Like Article Like Report The KeyboardEvent keyCode property is used for returning the Unicode character code of the key that has been used to trigger an onkeypress event. The KeyboardEvent keyCode property is also used for returning the Unicode character code of a key that has triggered an onkeydown or onkeyup event. The key codes represent an actual key on the keyboard whereas character codes represent an ASCII character. Upper case and lower case characters have different codes. Syntax event.keyCode Note: This property has been DEPRECATED and is no longer recommended. Below program illustrates the KeyboardEvent keyCode Property : Example-1: Getting the Unicode value of a pressed keyboard key. html <!DOCTYPE html> <html> <head> <title>KeyboardEvent keyCode Property in HTML </title> <style> div { border: 3px solid green; height: 100px; width: 500px; } h1 { color: green; } h2 { font-family: Impact; } body { text-align: center; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>KeyboardEvent keyCode Property</h2> <p>To return the keycode of a key, insert some character in the field.</p> <input type="text" size="20" onkeypress="keyboard(event)"> <p id="test"></p> <script> function keyboard(event) { // Return key code. var k = event.which || event.keyCode; document.getElementById("test").innerHTML = "The keycode value of the pressed key is : " + k; } </script> </body> </html> Output: Before pressing a button: After pressing a button: Supported Browsers: OperaInternet ExplorerGoogle ChromeFirefoxApple Safari Comment More infoAdvertise with us Next Article HTML | DOM KeyboardEvent keyCode Property S Shubrodeep Banerjee Follow Improve Article Tags : Web Technologies HTML HTML-DOM Similar Reads HTML DOM History length Property The History length property in HTML is used to return the count of URLs in the history list of the current browser window. The minimum value returned by this property is 1 because the current page is loaded at the moment whereas the maximum count that can be displayed is 50. Web browsers such as Int 1 min read HTML DOM History back() Method The History back() method in HTML is used to load the previous URL in the history list. It has the same practical application as the back button in our web browsers. This method will not work if the previous page does not exist. This method does not contain any parameter.Syntax: history.back Below p 1 min read HTML DOM History go() Method The History go() method in HTML is used for loading a specific URL from the history list. It is a better alternative to history.back() and history.forward() methods if a number or the URL of the specific page is known and wants to load from your history. Syntax: history.go( number|URL )Parameters: T 2 min read HTML DOM console groupEnd() Method The console.groupEnd() method in HTML is used to indicate the end of a group of messages in the console that has been created using the console.group() method. This method does not accept any parameter. Syntax:console.groupEnd()Example: The below program illustrates the console.groupEnd() method in 2 min read HTML DOM readyState Property The readyState property in HTML is used to return the loading status of the current document. This property is used for read-only. Syntax:document.readyStateReturn Value: It returns a string value which is used to define the status of the current document. The one of five status are listed below:uni 2 min read HTML DOM Location host Property The Location Host property in HTML is used to sets or return the hostname and port of a URL. The Location Hash property doesn't return the port number if it is not specified in the URL. Syntax: It returns the host property. location.hostIt is used to set the host property. location.host = hostname:p 1 min read HTML DOM Location protocol Property The Location protocol property in HTML is used to return the protocol or set the protocol of the current URL. It returns a string that contains the protocol of the current URL, including the colon (:). Syntax: It returns the protocol property. location.protocolIt is used to set the protocol property 1 min read HTML DOM Location pathname Property The Location pathname property in HTML is used to set or return the pathname of a URL. The Location pathname property returns a string that represents the pathname of the URL. Syntax: It returns the pathname property.location.pathnameIt is used to set the pathname property.location.pathname = pathEx 1 min read HTML DOM Location hostname Property The Location hostname property in HTML is used to return the hostname of the current URL. The Location hostname property returns a string that contains the domain name, or the IP address of a URL. Syntax: It returns the hostname property. location.hostname It is used to set the hostname property. lo 1 min read HTML DOM Location href Property The Location href property in HTML is used to set or return the complete URL of the current page. The Location href property can also be used to set the href value point to another website or point to an email address. The Location href property returns a string that contains the entire URL of the p 2 min read Like