Found 2556 Articles for HTML

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

Rishi Raj
Updated on 23-Jun-2020 09:21:58

409 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.ExampleYou can try to run the following code to learn how to work with backgroundAttachment property with JavaScript −Live Demo           Click to Set background       Demo Text       Demo Text       Demo Text       Demo Text       Demo Text       Demo Text       Demo Text       Demo Text       Demo Text     ... Read More

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

karthikeya Boyini
Updated on 23-Jun-2020 09:22:27

53 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 −ExampleLive Demo           Convert 0 to Number                var myVal = 0;          document.write("Number: " + Number(myVal));          

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

Ramu Prasad
Updated on 23-Jun-2020 09:23:07

94 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);          

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

Swarali Sree
Updated on 23-May-2020 11:41:14

67 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.Live Demo           Click to Set background                function display() {             document.body.style.background = "url('https://www.tutorialspoint.com/html5/images/html5-mini-logo.jpg') repeat right top";          }          

How to search and display the pathname part of the href attribute of an area with JavaScript?

Vrundesha Joshi
Updated on 23-May-2020 11:37:05

66 Views

To get the pathname part of the href attribute of an area in JavaScript, use the pathname property.ExampleYou can try to run the following code to display the pathname part.                                                var x = document.getElementById("myarea").pathname;          document.write("Pathname: "+x);          

How to search the alternate text of an image-map area in JavaScript?

Sravani S
Updated on 23-May-2020 11:22:37

97 Views

To search the alternate (alt) text of an image-map area in JavaScript, use the alt property. You can try to run the following code to get the alternate text.Example                                                      var x = document.getElementById("myarea").alt;          document.write("Alternate Text: "+x);          

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

Jennifer Nicholas
Updated on 23-May-2020 11:22:09

123 Views

To search the value of the type attribute of a link in JavaScript, use the type property. You can try to run the following code to get the value of type attribute.Example           Qries                var x = document.getElementById("qriesid").type;          document.write("Value of the type attribute: "+x);          

How to search the value of the target attribute of a link in JavaScript?

Nikitha N
Updated on 23-May-2020 11:21:40

230 Views

To search the value of the target attribute of a link in JavaScript, use the target property. You can try to run the following code to get the value of target attribute.Example           Qries                var x = document.getElementById("qriesid").target;          document.write("Value of the target attribute: "+x);          

Which is the event when the browser window is resized in JavaScript?

Nishtha Thakur
Updated on 23-Jun-2020 09:18:50

79 Views

Use window.outerWidth and window.outerHeight event in JavaScript to get the size of windows when the browser is resized.ExampleYou can try to run the following code to work with events to check the browser window size −                    function resizeFunction() {             var val = "Window Width=" + window.outerWidth + ", Window Height="             + window.outerHeight;             document.getElementById("test").innerHTML = val;          }                     Resize browser window and check the window (browser window)       height and width again.          

What is the role of parseInt() method in JavaScript?

Smita Kapse
Updated on 23-May-2020 11:04:04

132 Views

Use the parseInt() method in JavaScript to return an integer after parsing a string. You can also set the numeral system as a second parameter.ExampleYou can try to run the following code to learn how to work with parseFloat() method in JavaScript.                    var val1 = parseInt("20.50");          var val2 = parseInt("30 minutes");          var val3 = parseInt("20",16);                    document.write(val1);          document.write(""+val2);          document.write(""+val3);          

Advertisements