HTML DOM Mark Object

Mark Object  The Mark Object is new in HTML5. The Mark object represents an HTML <mark> element. Note: The <mark> element is not supported in Internet Explorer 8 and earlier versions. Access a Mark Object You can access a <mark> element by using getElementById(): Example var x = document.getElementById(“myMark”); Try it Yourself » Create a Mark Object […]

HTML DOM Map Object

Map Object The Map object represents an HTML <map> element. Access a Map Object You can access a <map> element by using getElementById(): Example var x = document.getElementById(“myMap”); Try it Yourself » Create a Map Object You can create a <map> element by using the document.createElement() method: Example var x = document.createElement(“MAP”); Try it Yourself » Map […]

HTML <main> Tag

Example <main> <h1>Web Browsers</h1> <p>Google Chrome, Firefox, and Internet Explorer are the most used browsers today.</p><article> <h1>Google Chrome</h1> <p>Google Chrome is a free, open-source web browser developed by Google, released in 2008.</p> </article><article> <h1>Internet Explorer</h1> <p>Internet Explorer is a free web browser from Microsoft, released in 1995.</p> </article> <article> <h1>Mozilla Firefox</h1> <p>Firefox is a free, […]

HTML <link> Attribute

HTML <link> charset Attribute Example The charset attribute indicates that the linked document is written in Japanese: <link href=”domoarigato.htm” rel=”parent” charset=”ISO-2022-JP”> Definition and Usage The <link> charset attribute is not supported in HTML5. The charset attribute specifies the character encoding of the linked document. The default character-set for modern browsers is ISO-8859-1. Syntax <link charset=”character_set”> Attribute Values Value Description character_set […]

HTML DOM Link Object

Link Object The Link object represents an HTML <link> element. Access a Link Object You can access a <link> element by using getElementById(): Example var x = document.getElementById(“myLink”); Try it Yourself » Create a Link Object You can create a <link> element by using the document.createElement() method: Example var x = document.createElement(“LINK”); Try it Yourself » Link […]

HTML <menu> Tag

  Note: This content has been removed from HTML5 family      

HTML DOM Label Object

Label Object The Label object represents an HTML <label> element. Access a Label Object You can access a <label> element by using getElementById(): Example var x = document.getElementById(“myLabel”); Try it Yourself » Create a Label Object You can create a <label> element by using the document.createElement() method: Example var x = document.createElement(“LABEL”); Try it Yourself » Label […]

HTML DOM Ins Object

Ins Object The Ins object represents an HTML <ins> element. Access an Ins Object You can access an <ins> element by using getElementById(): Example var x = document.getElementById(“myIns”); Try it Yourself » Create an Ins Object You can create an <ins> element by using the document.createElement() method: Example var x = document.createElement(“INS”); Try it Yourself » Ins […]

HTML <input> Type Attribute Values

HTML <input type=”button”> Example A push button that activates a JavaScript when it is clicked: <input type=”button” value=”Click me” onclick=”msg()”> Try it Yourself HTML <input type=”checkbox”> Example Let the user select one or more options of a limited number of choices: <input type=”checkbox” name=”vehicle1″ value=”Bike”> I have a bike<br> <input type=”checkbox” name=”vehicle2″ value=”Car”> I have a car<br> <input type=”checkbox” name=”vehicle3″ value=”Boat” checked> I have a boat<br> Try it Yourself » HTML <input type=”color”> Example […]

HTML <input> type Attribute

Example An HTML form with two different input types; text and submit: <form action=”/action_page.php”> Username: <input type=”text” name=”usrname”><br> <input type=”submit” value=”Submit”> </form> Try it Yourself » More “Try it Yourself” examples below. Definition and Usage The type attribute specifies the type of <input> element to display. The default type is text. Tip: The type attribute is not a required attribute, but we […]

HTML <input> step Attribute

Example An HTML form with an input field with a specified legal number intervals: <form action=”/action_page.php”> <input type=”number” name=”points” step=”3″> <input type=”submit”> </form> Try it Yourself » Definition and Usage The step attribute specifies the legal number intervals for an <input> element. Example: if step=”3″, legal numbers could be -3, 0, 3, 6, etc. Tip: The step attribute can be used […]

HTML <input> src Attribute

Example An HTML form with an image that represents the submit button: <form action=”/action_page.php”> First name: <input type=”text” name=”fname”><br> <input type=”image” src=”submit.gif” alt=”Submit”> </form> Try it Yourself » Definition and Usage The src attribute specifies the URL of the image to use as a submit button. Note: The src attribute is required for <input type=”image”>, and can only be used with <input type=”image”>. […]

HTML <input> size Attribute

Example An HTML form with two input fields with a width of 35 and 4 characters: <form action=”/action_page.php”> Email: <input type=”text” name=”email” size=”35″><br> PIN: <input type=”text” name=”pin” maxlength=”4″ size=”4″><br> <input type=”submit” value=”Submit”> </form> Try it Yourself » Definition and Usage The size attribute specifies the visible width, in characters, of an <input> element. Note: The size attribute works with the following input types: text, search, tel, url, email, […]

HTML <input> required Attribute

Example An HTML form with a required input field: <form action=”/action_page.php”> Username: <input type=”text” name=”usrname” required> <input type=”submit”> </form> Try it Yourself » Definition and Usage The required attribute is a boolean attribute. When present, it specifies that an input field must be filled out before submitting the form. Note: The required attribute works with the following input types: text, search, url, […]

HTML <input> readonly Attribute

Example An HTML form with a read-only input field: <form action=”/action_page.php”> Country: <input type=”text” name=”country” value=”Norway” readonly><br> <input type=”submit” value=”Submit”> </form> Try it Yourself » Definition and Usage The readonly attribute is a boolean attribute. When present, it specifies that an input field is read-only. A read-only input field cannot be modified (however, a user can tab to it, highlight it, and copy […]

HTML <input> placeholder Attribute

Example Two input fields with a placeholder text: <form action=”/action_page.php”> <input type=”text” name=”fname” placeholder=”First name”><br> <input type=”text” name=”lname” placeholder=”Last name”><br> <input type=”submit” value=”Submit”> </form> Try it Yourself » Definition and Usage The placeholder attribute specifies a short hint that describes the expected value of an input field (e.g. a sample value or a short description of the expected format). The short hint is displayed […]

HTML <input> pattern Attribute

Example An HTML form with an input field that can contain only three letters (no numbers or special characters): <form action=”/action_page.php”> Country code: <input type=”text” name=”country_code” pattern=”[A-Za-z]{3}” title=”Three letter country code”> <input type=”submit”> </form> Try it Yourself » More “Try it Yourself” examples below. Definition and Usage The pattern attribute specifies a regular expression that the <input> element’s value is checked […]

HTML <input> name Attribute

Example An HTML form with three input fields; two text fields and one submit button: <form action=”/action_page.php”> Name: <input type=”text” name=”fullname”><br> Email: <input type=”text” name=”email”><br> <input type=”submit” value=”Submit”> </form> Try it Yourself » Definition and Usage The name attribute specifies the name of an <input> element. The name attribute is used to reference elements in a JavaScript, or to reference form data after a […]