Javascript Articles

Page 8 of 534

What is nodeValue property in JavaScript HTML DOM?

Vikyath Ram
Vikyath Ram
Updated on 11-Mar-2026 336 Views

The nodeValue property is used to get the node value. You need to specify the node.ExampleYou can try to run the following code to learn how to get nodeValue property.           Get the node value       Demo Button Text                var val = document.getElementsByTagName("BUTTON")[0];          var res = val.childNodes[0].nodeValue;          document.write("Node Value: "+res);          

Read More

How -Infinity is converted to Number in JavaScript?

Monica Mona
Monica Mona
Updated on 11-Mar-2026 268 Views

Use the Number() method in JavaScript to convert to Number. You can try to run the following code to learn how to convert -Infinity Number in JavaScript.Example           Convert -Infinity to Number                var myVal = -Infinity;          document.write("Number : " + Number(myVal));           OutputConvert -Infinity to Number Number : -Infinity

Read More

What will happen when [50,100] is converted to Number in JavaScript?

Sai Subramanyam
Sai Subramanyam
Updated on 11-Mar-2026 160 Views

Use the Number() method in JavaScript to convert to Number. You can try to run the following code to learn how to convert [50, 100] to Number in JavaScript − Example Live Demo Convert [50,100] to Number var myVal = [50,100]; document.write("Number: " + Number(myVal));

Read More

How to use JavaScript to set cookies for homepage only?

Vrundesha Joshi
Vrundesha Joshi
Updated on 11-Mar-2026 370 Views

To set cookies for a homepage, add the page to the homepage itself.ExampleYou can try to run the following code to set cookies                                                  Enter name:                    

Read More

How to show image in alert box using JavaScript?

Nancy Den
Nancy Den
Updated on 11-Mar-2026 2K+ Views

To show an image in alert box, try to run the following code. Here, an alert image is added to the custom alert box −Example                                function functionAlert(msg, myYes) {             var confirmBox = $("#confirm");             confirmBox.find(".message").text(msg);             confirmBox.find(".yes").unbind().click(function() {                confirmBox.hide();             });             confirmBox.find(".yes").click(myYes);           ...

Read More

Why does the JavaScript void statement evaluate an expression?

Giri Raju
Giri Raju
Updated on 11-Mar-2026 144 Views

The JavaScript void returns an expression to remove the side effect and return the undefined primitive value. This side effect may occur while inserting expression in a web page.Let’s see an example of the void. The void(0) can be used with hyperlinks to obtain the undefined primitive value, Example                    Understanding JavaScript void(0)                 Click me not once, but twice.     We used JavaScript:void(0) above to prevent the page from reloading when the button is clicked the first time.The code will only ...

Read More

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
Showing 71–80 of 5,339 articles
« Prev 1 6 7 8 9 10 534 Next »
Advertisements