Javascript Articles

Page 8 of 534

How to set the style of the outline around an element with JavaScript?

Arushi
Arushi
Updated on 11-Mar-2026 300 Views

To set the outline style, use the outlineStyle property. The outline can be solid, dotted, dashed, etc.ExampleYou can try to run the following code to set the style of the outline around an element with JavaScript −                    #box {             width: 450px;             background-color: orange;             border: 3px solid red;             margin-left: 20px;          }                     ...

Read More

What to do with content that renders outside the element box with JavaScript?

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 284 Views

If the content renders outside the element box, use the overflow property to add a scroll. This will ease visitors in reading the entire content.ExampleYou can try to run the following code to learn how to work with overflow property in JavaScript −                    #box {             width: 450px;             height: 150px;             background-color: orange;             border: 3px solid red;             margin-left: 20px;     ...

Read More

What should be done with the left/ right edges of the content on overflow with JavaScript?

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

If the content overflows, the workaround with overflowX property to solve the left/ right edge issues and set a scroll. Adding a scroll allows visitors to easily read the entire content.ExampleYou can try to run the following code to learn what is to be done with the left/ right edges of the content on overflow with JavaScript −                    #box {             width: 350px;             height: 150px;             background-color: orange;           ...

Read More

Align the components with Bootstrap

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 11-Mar-2026 386 Views

To align the components like nav links, forms, buttons, or text to left or right in a navbar using the utility classes .navbar-left or .navbar-right. Both classes will add a CSS float in the specified direction.ExampleYou can try to run the following code to align components           Bootstrap Example                                                       Alignment                                                                                                    Java                                                                                jmeter                      EJB                      Jasper Report                                            Separated link                                            One more separated link                                                                          Left align-Submit Button                         Left align-Text                                                                                Java                                                                                jmeter                      EJB                      Jasper Report                                            Separated link                                            One more separated link                                                                                             Right align-Submit Button                                         Right align-Text                    

Read More

How to add background music to your web page?

Vikyath Ram
Vikyath Ram
Updated on 11-Mar-2026 36K+ Views

To add background music on a web page, use … element. Also, use the autoplay attribute. This will run music in the background whenever the page loads.Set the width and height in a way the player hides on the web page. The loop attribute is added to specify whether the audio will start over again. Add the music file to the server and mention the link in src attribute.ExampleYou can try to run the following code to add background music to your web page:           HTML background music               ...

Read More

What does language attribute do in <script> tag in Javascript?

Sai Subramanyam
Sai Subramanyam
Updated on 11-Mar-2026 1K+ Views

The language attribute is used to mention the scripting language. Typically, its value will be javascript. Although recent versions of HTML (and XHTML, its successor) have phased out the use of this attribute. Yes, it is now deprecated. Here you can see how it was used.

Read More

How to set a cookie and get a cookie with JavaScript?

Sreemaha
Sreemaha
Updated on 11-Mar-2026 4K+ Views

Set Cookie The simplest way to create a cookie is to assign a string value to the document.cookie object, which looks like this: document.cookie = "key1=value1;key2=value2;expires=date"; Here the "expires" attribute is optional. If you provide this attribute with a valid date or time, then the cookie will expire on a given date or time and thereafter, the cookies' value will not be accessible. Example Try the following. It sets a customer name in an input cookie.                                                     Enter name:                       Get Cookie Reading a cookie is just as simple as writing ...

Read More

What is the difference between “lang” and “type” attributes in a script tag?

Arushi
Arushi
Updated on 11-Mar-2026 334 Views

JavaScript lang attributeThis attribute specifies what scripting language you are using. Typically, its value will be javascript. Although recent versions of HTML (and XHTML, its successor) have phased out the use of this attribute.JavaScript type attributeThis attribute is what is now recommended to indicate the scripting language in use and its value should be set to "text/javascript".Here you can see how it is used:                              

Read More

When should I use an Inline script and when to use external JavaScript file?

Sai Subramanyam
Sai Subramanyam
Updated on 11-Mar-2026 2K+ Views

To enhance performance, try to keep JavaScript external. The separate code makes it easier for web browsers to cache. However, use inline scripts only when you’re making single page websites. Still, it's better to use external code i.e. external JavaScript. To place JavaScript in external file create an external JavaScript file with the extension .js. After creating, add it to the HTML file in the script tag. The src attribute is used to include that external JavaScript file. If you have more than one external JavaScript file, then add it to the same web page to increase the performance of ...

Read More

What are generator functions in JavaScript?

Prabhas
Prabhas
Updated on 11-Mar-2026 329 Views

Generator Functions allows execution of code in between when a function is exited and resumed later. So, generators can be used to manage flow control in a code. Cancel asynchronous operations easily since execution can be paused anytime.Here’s the syntax; do not forget to add an asterisk after the “function” keyword. You can add an asterisk using any of the following −function *myFunction() {} // or function* myFunction() {} // or function*myFunction() {}ExampleLet’s see how to use a generator function                    function* display() {             var ...

Read More
Showing 71–80 of 5,339 articles
« Prev 1 6 7 8 9 10 534 Next »
Advertisements