Found 448 Articles for Programming Scripts

Does HTML5 Canvas support Double Buffering?

Chandu yadav
Updated on 24-Jan-2020 10:38:56

385 Views

For double buffering on the canvas, create a 2nd canvas element and draw to it. After that draw the image to the first canvas using the drawImage() method,// canvas element var canvas1 = document.getElementById('canvas'); var context1 = canvas1.getContext('2d'); // buffer canvas var canvas2 = document.createElement('canvas'); canvas2.width = 250; canvas2.height =250; var context2 = canvas2.getContext('2d'); // create on the canvas context2.beginPath(); context2.moveTo(10,10); context2.lineTo(10,30); context2.stroke(); //render the buffered canvas context1.drawImage(canvas2, 0, 0);

Create editable content in an HTML document

Bhanu Priya
Updated on 06-Oct-2023 14:37:28

512 Views

In Html, we can edit the content by using contenteditable attribute, it specifies whether the elements content is editable or not by the user. The property of contentEditable is set or returns if the content of an element is editable. Syntax The usage/syntax of editable content in HTML is − The above contenteditable attribute has two values true/false. True indicates that the element is editable. False indicates that the element cannot be edited. Example Following is the example, to create editable content in an HTML − This ... Read More

Listing down various options for input values in HTML5

Govinda Sai
Updated on 24-Jun-2020 07:21:22

111 Views

The HTML tag specifies set of options for element. You can try to run the following code to list options for input values in HTML5 −Example           HTML Datalist Tag                                                                                   Try to add any of the tutorial name mentioned above.    

How to add background music in HTML?

Vrundesha Joshi
Updated on 24-Jun-2020 07:22:33

10K+ Views

The HTML tag is used to play music in the background. This tag is for Internet Explorer only.ExampleYou can try to run the following code to add background music in HTML −           HTML bgsound Tag                     Plays sound file in the background.     The HTML tag also supports the following attributes −AttributeValueDescriptionloopnumberLets you replay a background soundtrack a certain number of times.srcURLSpecifies the path of the sound file.

How to iterate a JavaScript object's properties using jQuery?

Lokesh Badavath
Updated on 18-Nov-2022 12:00:20

1K+ Views

In this article, we are going to learn how to iterate a JavaScript object’s properties using jQuery. The simplest way to iterate over an object with JavaScript is to use a for in loop. The for statement will iterate over the objects as an array, but the loop will send the key to the object instead of an index as a parameter. This loop is used to iterate over all non-Symbol iterative properties of an object. The hasOwnProperty() method can be used to check if the property belongs to the object itself. The value of each key of the ... Read More

How to get the value of the usemap attribute of an image with JavaScript?

Sravani S
Updated on 23-Jun-2020 11:03:29

120 Views

To get the value of the usemap attribute of an image, use the useMap property. You can try to run the following code to display the usemap attribute value −Example                                                var x = document.getElementById("myid").useMap;          document.write("Usemap: "+x);          

How to set all the border bottom properties in one declaration in JavaScript DOM?

Lakshmi Srinivas
Updated on 23-Jun-2020 11:07:31

80 Views

To set the border bottom properties in one declaration in JavaScript, use the borderBottom property. It allows you to set the border-bottom-width, border-bottom-style, and border-bottom-color.ExampleYou can try to run the following code to learn how to set border bottom properties −Live Demo                    #box {             border: 2px dashed blue;             width: 120px;             height: 120px;          }                     Set border bottom color                Demo Text          Demo Text                      function display() {             document.getElementById("box").style.borderBottom = "thin dashed #000000";          }          

What will happen when ["demo"] is converted to Number in JavaScript?

karthikeya Boyini
Updated on 23-Jun-2020 09:58:50

61 Views

Use the Number() method in JavaScript to convert to Number. You can try to run the following code to learn how to convert ["demo"] to Number in JavaScript −ExampleLive Demo           Convert ["demo"] to Number                var myVal = ["demo"];          document.write("Number: " + Number(myVal));          

How to set the starting position of a background image in JavaScript DOM?

Sharon Christine
Updated on 23-Jun-2020 10:00:38

331 Views

To set the starting position of a background image in JavaScript, use the backgroundposition property. It allows you to set the position of the image.ExampleYou can try to run the following code to learn how to set all the position of a background image with JavaScript −Live Demo                    body {             background-repeat: no-repeat;          }                     Click to Set background image                function display() {             document.body.style.backgroundImage = "url('https://www.tutorialspoint.com/html5/images/html5-mini-logo.jpg')";             document.body.style.backgroundPosition="top right";          }          

What will happen when 1 is converted to Boolean in JavaScript?

Paul Richard
Updated on 23-Jun-2020 09:20:39

73 Views

You can try to run the following code to learn how to convert 1 to Boolean in JavaScript −ExampleLive Demo           Convert 1 to Boolean                var myVal = 1;          document.write("Boolean: " + Boolean(myVal));          

Advertisements