Found 2202 Articles for HTML

HTML
autocomplete Attribute

Ankith Reddy
Updated on 30-Jul-2019 22:30:26

148 Views

The autocomplete attribute of the element allows you to set whether the autocomplete for the form should be on or off. The web browser automatically fills the values if the autocomplete is on. This only happens if the user already entered values before.Following is the syntax −Above, on | off values are to be set for autocomplete to appear or not. Set on if you want the browser to complete the entries based on previously entered values, whereas off doesn’t allow to complete the entries.Let us now see an example to implement the autocomplete attribute of the element ... Read More

HTML DOM activeElement Property

Ankith Reddy
Updated on 30-Jul-2019 22:30:26

189 Views

The HTML DOM activeElement property is a read-only property to return the currently focused element in the document.Following is the syntax −document.activeElementLet us now see an example to implement the DOM activeElement property −Example Live Demo Heading Two Click in the element to get the active element. function display() { var a = document.activeElement.tagName; document.getElementById("myid").innerHTML = a; } OutputNow, click the element to display the same currently active element −

HTML canvas shadowColor Property

Arjun Thakur
Updated on 12-Jun-2020 08:00:20

149 Views

The shadowColor property of the HTML canvas is used to set the color for shadow. The default value is #000000.Following is the syntax −ctx.shadowColor=color;Above, set the color for shadow.Let us now see an example to implement the shadowColor property of canvas −Example Live Demo    var c = document.getElementById("newCanvas");    var ctx = c.getContext("2d");    ctx.shadowBlur = 20;    ctx.shadowColor = "gray";    ctx.fillStyle = "blue";    ctx.fillRect(40, 40, 200, 250); Output

HTML

Ankith Reddy
Updated on 29-Jun-2020 09:37:40

419 Views

The datetime attribute of the element is used to display the machine-readable date time.Following is the syntax −Above, the attribute datetime displays the datetime −YYYY - yearMM - monthDD - day of the monthhh - hourmm - minutesss - secondsTZD - Time Zone DesignatorYou can also set PTDHMS −P - prefix for "Period"D - prefix for "Days"H - prefix for "Hours"M - prefix for "Minutes"S - prefix for "Seconds"Let us now see an example to implement the datetime attribute of the element −Example Live Demo    Exam Results    Result would be announced on 6th June.    New ... Read More

HTML defaultPrevented Event Property

Chandu yadav
Updated on 30-Jul-2019 22:30:26

171 Views

The defaultPrevented event property in HTML is used to check whether the preventDefault() method was called or not. It returns a boolean value i.e. true if the preventDefault() method was called, else false.Following is the syntax −event.defaultPreventedLet us now see an example to implement the defaultPrevented event property in HTML −Example Live Demo Demo Heading Demo (click me)    document.getElementById("myid").addEventListener("click", function(event){       event.preventDefault()       alert("Was preventDefault() called: " + event.defaultPrevented);    }); OutputClick on the link and the following would get displayed in the alert box −

HTML currentTarget Event Property

Arjun Thakur
Updated on 30-Jul-2019 22:30:26

146 Views

The currentTarget event property in HTML is used to get the element whose event listeners triggered the event.Following is the syntax −event.currentTargetLet us now see an example to implement the currentTarget event property −Example Live Demo Get the element Click on this line to generate an alert box displaying the element whose eventlistener triggered the event.    function myFunction(event) {       alert("Element = "+event.currentTarget.nodeName);    } OutputNow double click on the line as shown in the above screenshot to generate an alert box that would display the element whose event listeners triggered the event −

HTML width Attribute

Ankith Reddy
Updated on 30-Jul-2019 22:30:26

174 Views

The width attribute of the element is used to set the width of the canvas in pixels. Following is the syntax −Above, pixels_val is the width set in pixels. Let us now see an example to implement the width attribute of the element −Example Live Demo HTML5 canvas tag isn't supported by your browser. var c = document.getElementById("newCanvas"); var context = c.getContext("2d"); context.fillStyle = "#FF5655"; context.fillRect(100, 50, 60, 100); OutputIn the above example, we have created a canvas and used ... Read More

HTML

George John
Updated on 30-Jul-2019 22:30:26

155 Views

The type attribute of the element is used to set type of the button. Following is the syntax −Above, we have shown the different types set for the button element i.e.: submit −button: A clickable buttonsubmit: Submit button (submits form-data)reset: It is a reset button to reset it to the initial value.Let us now see an example to implement the type attribute of the button element in HTML −Example Live Demo Investor Information Give the information about the investor interested in funding: ID: Investor: Funds: ... Read More

HTML href Attribute

Arjun Thakur
Updated on 29-Jun-2020 09:18:05

201 Views

The href attribute of the element sets the base URL for all relative URLs. For example, base URL as https://example.com/tutorials for all the relative URLs like /html, /java, /jquery etc., which are eventually −https://example.com/tutorials/html https://example.com/tutorials/java https://example.com/tutorials/jqueryFollowing is the syntax −Above, absolute _URL is the absolute url for the base URL. Let us now see an example to implement the href attribute of the element −Example Live Demo    Tutorials List    Java Tutorial(This will act as https://www.example.com/tutorials/java.html)    jQuery Tutorial(This will act as https://www.example.com/tutorials/jquery.html)    Blockchain Tutorial(This will act as https://www.example.com/tutorials/blockchain.html)    Python Tutorial(This will ... Read More

HTML type Attribute

Chandu yadav
Updated on 30-Jul-2019 22:30:26

102 Views

The type attribute of the element sets the MIME (Multipurpose Internet Mail Extensions) type of the target url. Following is the syntax −Above, type_of_media is the standard media type of the linked document, for example, image/bmp, image/tiff, image/tff, etc.Let us now see an example to implement the type attribute of the element −Example Live Demo Learning Learn these technologies with ease....             OutputNow, when you will click on the HTML area, then the following png image would be visible. We have set the media type in that as image/png for the same −

Advertisements