Found 2202 Articles for HTML

How to use sockets in JavaScriptHTML?

Ankitha Reddy
Updated on 30-Jul-2019 22:30:22

230 Views

To use sockets, consider the WebSocket interface in JavaScript. This interface enables web applications to maintain bidirectional communications with server-side processes. To enable Web applications to maintain bidirectional communications with server-side processes, this specification introduces the WebSocket interface. Here are some of the methods to workaround with Web Sockets − socket = new WebSocket(url [, protocols ] ) Create a new socket using this, wherein parameters URL is a string for the connection and protocols is a string or array of string. socket . send( data ) The above is used to send data. Used to ... 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

202 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

150 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

104 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

504 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

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

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

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

641 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

106 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

145 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

140 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";          }          

Advertisements