Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Javascript Articles
Page 8 of 534
How to set the style of the outline around an element with JavaScript?
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 MoreWhat to do with content that renders outside the element box with JavaScript?
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 MoreWhat should be done with the left/ right edges of the content on overflow with JavaScript?
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 MoreAlign the components with Bootstrap
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 MoreHow to add background music to your web page?
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 MoreWhat does language attribute do in <script> tag in Javascript?
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 MoreHow to set a cookie and get a cookie with JavaScript?
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 MoreWhat is the difference between “lang” and “type” attributes in a script tag?
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 MoreWhen should I use an Inline script and when to use external JavaScript file?
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 MoreWhat are generator functions in JavaScript?
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