Javascript Articles

Page 462 of 534

How to set the left padding of an element with JavaScript?

Anvi Jain
Anvi Jain
Updated on 23-Jun-2020 744 Views

Use the paddingLeft property in JavaScript to set the left padding. You can try to run the following code to return the left padding of an element with JavaScript −Example                    #box {             border: 2px solid #FF0000;             width: 150px;             height: 70px;          }                     This is demo text.             Left padding                function display() {             document.getElementById("box").style.paddingLeft = "100px";          }          

Read More

How to set the style of the bottom border with JavaScript?

karthikeya Boyini
karthikeya Boyini
Updated on 23-Jun-2020 405 Views

To set the style of the bottom border, use the JavaScript borderBottomStyle property. It allows you to add a bottom border.ExampleYou can try to run the following code to set the style of the bottom border −           Demo Text             Click to set style of bottom border                function display() {             document.getElementById("box").style.borderBottomStyle = "dashed";          }          

Read More

How to set all the four border radius properties at once with JavaScript?

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 23-Jun-2020 207 Views

To set all the border-radius properties in JavaScript, use the borderRadius property. Set the border-radius properties at once using this. Example You can try to run the following code to learn how to set all the four border-radius properties −                  #box {          border: thick solid gray;          width: 200px;          height: 200px        }                    Demo Text            Add border radius              function display() {          document.getElementById("box").style.borderRadius = "20px";        }          

Read More

How to set border width, border style, and border color in one declaration with JavaScript?

Paul Richard
Paul Richard
Updated on 23-Jun-2020 1K+ Views

To set the border width, style, and color in a single declaration, use the border property in JavaScript. Example You can try to run the following code to learn how to set border in JavaScript −       Set border          Demo Text      Demo Text              function display() {        document.getElementById("box").style.border = "thick dashed #000000";      }       

Read More

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

Sravani S
Sravani S
Updated on 23-Jun-2020 239 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);          

Read More

With JavaScript how to change the width of a table border?

Nitya Raut
Nitya Raut
Updated on 23-Jun-2020 1K+ Views

To change the width of a table border, use the DOM border property. You can try to run the following code to change the width of a table border in JavaScript −Example                    function borderFunc(x) {             document.getElementById(x).style.border = "5px dashed blue";          }                                             One             Two                                 Three             Four                                 Five             Six                                          

Read More

How to search the querystring part of the href attribute of an area in JavaScript?

Ramu Prasad
Ramu Prasad
Updated on 23-Jun-2020 182 Views

To get the querystring of the href attribute of an area, use the search property. You can try to run the following code to search the querystring −Example                                                var x = document.getElementById("myarea").search;          document.write("Querystring: "+x);          

Read More

What will happen when 0 is converted to Number in JavaScript?

karthikeya Boyini
karthikeya Boyini
Updated on 23-Jun-2020 139 Views

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

Read More

How to set a background image to be fixed with JavaScript DOM?

Rishi Raj
Rishi Raj
Updated on 23-Jun-2020 693 Views

To set the background image to be fixed in JavaScript, use the backgroundAttachment property. It allows you to set an image that won't scroll. Example You can try to run the following code to learn how to work with backgroundAttachment property with JavaScript –       Click to Set background    Demo Text    Demo Text    Demo Text    Demo Text    Demo Text    Demo Text    Demo Text    Demo Text    Demo Text    Demo Text    Demo Text    Demo Text    Demo Text    Demo Text    Demo Text    Demo Text          function display() {       document.body.style.background = "url('https://www.tutorialspoint.com/html5/images/html5-mini-logo.jpg') no-repeat right top";       document.body.style.backgroundAttachment = "fixed";      } ...

Read More

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

Paul Richard
Paul Richard
Updated on 23-Jun-2020 162 Views

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

Read More
Showing 4611–4620 of 5,338 articles
« Prev 1 460 461 462 463 464 534 Next »
Advertisements