HTML DOM Location port Property Last Updated : 14 Jun, 2023 Comments Improve Suggest changes Like Article Like Report The HTML DOM Location Port property returns or sets the port number of the current URL. Syntax: Get the port property:Set the port property: Property Value: A String, to be assigned as a port Return Value: A String represents the port number of a URL. Example: In this example, we will use the HTML DOM Location Port. HTML <!DOCTYPE html> <html> <body> <h2>GeeksforGeeks</h2> <p id="demo"></p> <p><b>Note: </b>If the port number is default (80 for http and 443 for https), most browsers will display 0 or nothing. </p> <script> const url = document.createElement('a'); url.setAttribute('href', 'http://example.com:12345/gfg'); <!-- Return Location port Property --> window.alert("The URL port number of the current page is: " + url.port); </script> </body> </html> Output: Supported Browsers: Google Chrome 1Edge 12Internet Explorer 3Firefox 1Opera 12.1Safari 1 Comment More infoAdvertise with us Next Article HTML DOM Location port Property K KV30 Follow Improve Article Tags : Web Technologies HTML Web technologies HTML-DOM HTML-Property +1 More Similar Reads HTML DOM Style border Property The HTML DOM Style border Property is used to set or return the style of an element's border. We can set the different styles of the border for individual sides (top, right, bottom, left). The border-style property can take multiple values for each side. SyntaxIt is used to return the Style Propert 2 min read HTML DOM Span Object The DOM span object is used to represent the HTML <span> element. The span element can be accessed by using the getElementById() method. Syntax: document.getElementById("id"); Where 'id' is the ID assigned to the span tag. Example 1: In the below program the content inside the span element is 1 min read HTML DOM Input Button Object The DOM Input Type Button Object is used to represent the HTML <input> element with type="button". The Input Type Button element is accessed by getElementById(). Syntax: document.getElementById("ID"); Where âidâ is the ID assigned to the âinputâ tag. Example 1: In this example, we will see the 2 min read HTML DOM Address Object The DOM address object is used to represent the HTML <address> element. The address element can be accessed using the getElementById() method. Syntax: document.getElementById("id"); Where âidâ is the ID assigned to the address tag. Example 1: In the below program the address element is accesse 1 min read HTML DOM dl Object The DOM dl object is used to represent the HTML <dl> element. The dl element can be accessed using the getElementById() method. The dl is used to create a description list in HTML. Syntax: document.getElementById("id"); Where âidâ is the ID assigned to the dl tag. Example 1: In the below progr 1 min read HTML | DOM DT Object The DOM dt object is used to represent the HTML <dt> element. The dt element can be accessed using the getElementById() method. Syntax: document.getElementById("id"); Where âidâ is the ID assigned to the dt tag. Example-1: html <!DOCTYPE html> <html> <body> <h1 style = 1 min read HTML | DOM Style borderTopColor Property The borderTopColor property allows us to set/get the color of top border of element. Syntax: It returns the borderTopColor property. object.style.borderTopColorIt is used to set the borderTopColor property. object.style.borderTopColor = "color|transparent|initial| inherit" Return Value:The borderTop 2 min read HTML DOM Style borderLeftColor Property The borderLeftColor property in HTML DOM allows us to set/get the color to the left border of an element. Syntax: It is used to return the borderLeftColor property. object.style.borderLeftColorIt is used to set the borderLeftColor property. object.style.borderLeftColor = "color | transparent | ini 2 min read HTML DOM Paragraph Object The DOM paragraph object is used to represent the HTML <p> element. The p element is accessed by getElementById(). Syntax: document.getElementById("id"); Where âidâ is the ID assigned to the p tag. The below programs illustrate the p object: Property Values align: It is used to set or return t 2 min read HTML DOM Label Object The DOM Label Object is used to represent the <label> element. The Label element is accessed by getElementById(). Properties: control: It is used to return the labeled control.form: It is used to return the address of the form that contains the label.htmlFor: It is used to set or return the va 2 min read Like