Javascript Articles

Page 10 of 534

How to show all the options from a dropdown list with JavaScript?

Sharon Christine
Sharon Christine
Updated on 11-Mar-2026 5K+ Views

To show all the options from a dropdown list, use the options property. The property allows you to get all the options with length property.ExampleYou can try to run the following code to get all the options from a drop-down list.                                 One             Two             Three                                 Click the button to get all the options                function display() {             var a, i, options;             a = document.getElementById("selectNow");             options = "";             for (i = 0; i < a.length; i++) {                options = options + " " + a.options[i].text;             }             document.write("DropDown Options: "+options);          }          

Read More

How to get the value of the type attribute of a link in JavaScript?

Paul Richard
Paul Richard
Updated on 11-Mar-2026 609 Views

To get the value of the type attribute of a link in JavaScript, use the type property. The type attribute is used to tell that the document is html (text/html) or css (text/css), etc.ExampleYou can try to run the following code to get the value of the type attribute of a link.           Qries                var myVal = document.getElementById("anchorid").type;          document.write("Value of type attribute: "+myVal);          

Read More

How to work with document.embeds in JavaScript?

Jai Janardhan
Jai Janardhan
Updated on 11-Mar-2026 218 Views

Use the document.embeds property in JavaScript to get the number of tags in a document.ExampleYou can try to run the following code to implement document.embeds property in JavaScript.           JavaScript Example                              var num = document.embeds.length;          document.write("How many embed tags: "+num);          

Read More

How to work with document.images in JavaScript?

Arushi
Arushi
Updated on 11-Mar-2026 548 Views

Use the document.images property in JavaScript to get the number of tags in a document.ExampleYou can try to run the following code to implement document.images property in JavaScript.           JavaScript Example               TutorialsPoint Tutorials                            var num = document.images.length;          document.write("How many images? "+num);          

Read More

How to set the shape of the border of the top-right corner with JavaScript?

Fendadis John
Fendadis John
Updated on 11-Mar-2026 263 Views

To set the shape of the border of the top-right corner in JavaScript, use the borderTopRightRadius property. Set border radius using this property.ExampleYou can try to run the following code to learn how to set the shape of the top-right border with JavaScript.                    #box {             border: thick solid gray;             width: 300px;             height: 200px          }                     Demo Text             Change top right border radius                function display() {             document.getElementById("box").style.borderTopRightRadius = "20px";          }          

Read More

How to set all the background properties in one declaration with JavaScript DOM?

Swarali Sree
Swarali Sree
Updated on 11-Mar-2026 162 Views

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

Read More

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

Sharon Christine
Sharon Christine
Updated on 11-Mar-2026 555 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 −                    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";          }          

Read More

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

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 11-Mar-2026 191 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 −                    #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";          }          

Read More

How to set all the border left properties in one declaration with JavaScript?

Sai Subramanyam
Sai Subramanyam
Updated on 11-Mar-2026 144 Views

To set all the border left properties in a single declaration, use the borderLeft property. You can try to run the following code to learn how to set the border left properties − Example Live Demo #box { border: thick solid gray; width: 300px; height: 200px } Demo Text Change left border function display() { document.getElementById("box").style.borderLeft = "thick solid #000000"; }

Read More

How to set all the border top properties in one declaration with JavaScript?

Monica Mona
Monica Mona
Updated on 11-Mar-2026 307 Views

To set all the border top properties in a single declaration, use the borderTop property. With this property, you can set the border-top-width, border-top-style, and border-top-color property.ExampleYou can try to run the following code to learn how to work with border-top properties in JavaScript −                    #box {             border: thick solid gray;             width: 300px;             height: 200px          }                     Demo Text             Change top border                function display() {             document.getElementById("box").style.borderTop = "thick solid #000000";          }          

Read More
Showing 91–100 of 5,339 articles
« Prev 1 8 9 10 11 12 534 Next »
Advertisements