Javascript Articles

Page 8 of 534

How to customize the position of an alert box using JavaScript?

mkotla
mkotla
Updated on 11-Mar-2026 3K+ Views

To customize the position of an alert box, use the CSS “top” and “left” properties. We have a custom alert box, which we’ve created using jQuery and styled with CSS.ExampleYou can try to run the following code to customize the position of an alert box −                          function functionAlert(msg, myYes) {             var confirmBox = $("#confirm");             confirmBox.find(".message").text(msg);             confirmBox.find(".yes").unbind().click(function() {                confirmBox.hide();     ...

Read More

What is the difference between an acronym and abbr tags?

mkotla
mkotla
Updated on 11-Mar-2026 792 Views

In layman language, an acronym is a word formed by taking letters of each word in a phrase to form an abbreviation. Acronyms are a subset of abbreviations i.e. abbreviation is a shortened form of a word.The tag isn’t supported in HTML5 and is deprecated now. Do not use. To add abbreviation in HTML, use the tag. Both abbreviation and acronym are the shortened versions and are represented as a series of letters. Some of the examples include, "Mr.", "IST", "MRI", “NASA”, “ISRO” etc. ExampleYou can try to run the following code to add abbreviation in HTML.   ...

Read More

How to use the tag to define a relationship to an external resource?

Johar Ali
Johar Ali
Updated on 11-Mar-2026 289 Views

The tag is used in HTML to define a relationship to an external resource. It is used to link external style sheets. It gets added inside the … tag, but does not have a closing tag. Define your external CSS file in it.The CSS file created separately will have all the CSS code inside it. The href attribute adds the css file link.You can try to run the following code to include external CSS in HTML. The HTML file is here, with a link to CSS file style.cssExample                   ...

Read More

How do we upload external file on a website using HTML forms?

radhakrishna
radhakrishna
Updated on 11-Mar-2026 5K+ Views

If you want to allow a user to upload an external file to your website, you need to use a file upload box, also known as a file select box. This is also created using the element but type attribute is set to file.ExampleYou can try to run the following code to upload an external file to your website −           File Upload                                   Here are the attributes of the file upload box −Sr.NoAttribute & Description1nameUsed ...

Read More

How to use the submit button in HTML forms?

mkotla
mkotla
Updated on 11-Mar-2026 5K+ Views

Submit button automatically submits a form on click. Using HTML forms, you can easily take user input. The tag is used to get user input, by adding the form elements. Different types of form elements include text input, radio button input, submit button, etc.Let’s learn about how to use the submit button in HTML forms. It is also created using HTML tag but type attribute is set to button.You can try to run the following code to use submit button to submit and reset a form. Under the action, attribute add the file, where you want to reach after ...

Read More

How to use JavaScript to redirect an HTML page?

Rishi Raj
Rishi Raj
Updated on 11-Mar-2026 2K+ Views

You might have encountered a situation where you clicked a URL to reach a page X but internally you were directed to another page Y. It happens due to page redirection.It is quite simple to do a page redirect using JavaScript on the client side. To redirect your site visitors to a new page, you just need to add a line in your head section as follows.You can try to run the following code to learn how to use JavaScript to redirect an HTML page. Here, we will redirect to the homepageExample               ...

Read More

How to use Meta Tag to redirect an HTML page?

Paul Richard
Paul Richard
Updated on 11-Mar-2026 13K+ Views

Page redirection is a situation where you clicked a URL to reach a page X but internally you were directed to another page Y. It happens due to page redirection.To use a META Tag to redirect your site is quite easy. With this, use the http-equiv attribute to provide an HTTP header for the value of the content attribute.The following is an example of redirecting current page to another page after 2 seconds. If you want to redirect page immediately then do not specify the content attribute.Example           HTML Meta Tag                     This is demo text.    

Read More

How to append an item into a JavaScript array?

Sravani S
Sravani S
Updated on 11-Mar-2026 297 Views

To append an item to a JavaScript array, use the push() method.ExampleYou can try to run the following code to append an item:                    var arr = ["marketing", "technical", "finance", "sales"];          arr.push("HR");          document.write(arr);           Outputmarketing,technical,finance,sales,HR

Read More

How to create a zero-filled JavaScript array?

Ramu Prasad
Ramu Prasad
Updated on 11-Mar-2026 179 Views

To create a zero-filled JavaScript array, use the Unit8Array typed array.ExampleYou can try to run the following code:                    var arr1 = ["marketing", "technical", "finance", "sales"];          var arr2 = new Uint8Array(4);          document.write(arr1);          document.write("Zero filled array: "+arr2);          

Read More

What is the best way to initialize a JavaScript Date to midnight?

V Jyothi
V Jyothi
Updated on 11-Mar-2026 557 Views

To initialize a JavaScript Date to midnight, set hours like the following −setHours(0,0,0,0);ExampleYou can try to run the following code to set a date to midnight −                    var dt;          dt = new Date();          dt.setHours(0,0,0,0);          document.write(dt);           OutputMon May 28 2018 00:00:00 GMT+0530 (India Standard Time)

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