Ramu Prasad has Published 69 Articles

Java string comparison sample code examples

Ramu Prasad

Ramu Prasad

Updated on 28-Nov-2024 13:01:10

211 Views

In this article, we will learn how to compare strings in Java using the compareTo() method and the == operator. These methods help in checking string values and references. comapareTo() method The compareTo() method compares two strings lexicographically. The comparison is based on the Unicode value of each character in ... Read More

How to add a variable in HTML?

Ramu Prasad

Ramu Prasad

Updated on 04-Oct-2023 21:45:38

24K+ Views

Use the tag in HTML to add a variable. The HTML tag is used to format text in a document. It can include a variable in a mathematical expression. Example You can try to run the following code to add a variable in HTML −   ... Read More

How to redirect to another webpage using JavaScript?

Ramu Prasad

Ramu Prasad

Updated on 20-Apr-2022 12:40:56

21K+ Views

The window.location object contains the current location or URL information. We can redirect the users to another webpage using the properties of this object. window.location can be written without the prefix window.We use the following properties of the window.location object to redirect the users to another webpage −window.location.href- it returns ... Read More

How to make graphics with a script in HTML?

Ramu Prasad

Ramu Prasad

Updated on 24-Jun-2020 08:51:09

766 Views

To make graphics with a script, use the tag. The HTML tag is for drawing graphics, animations, etc using scripting.The following are the attributes of the tag −AttributeValueDescriptionheight pixelsSpecifies the height of the canvas.width pixelsSpecifies the width of the canvas.ExampleYou can try to run the following code ... Read More

How to fix Array indexOf() in JavaScript for Internet Explorer browsers?

Ramu Prasad

Ramu Prasad

Updated on 24-Jun-2020 06:37:02

454 Views

To fix Array.indexOf() for Internet Explorer web browser, use the following −jQuery.inArray( value, array [, fromIndex ] )Add the following,

Why does the JavaScript need to start with “;”?

Ramu Prasad

Ramu Prasad

Updated on 23-Jun-2020 11:51:06

158 Views

JavaScript uses a semi-colon (;) to avoid any confusion in code, especially the beginning of a new line.ExampleYou can still use the following to avoid any chaos in the code −return {    'var':myVal } // using semi-colon; (function( $ ) {    // }

How to set the capitalization of a text with JavaScript?

Ramu Prasad

Ramu Prasad

Updated on 23-Jun-2020 11:35:30

219 Views

To set the capitalization, use the textTransform property in JavaScript. Set it to capitalize, if you want the first letter of every word to be a capital letter.ExampleYou can try to run the following code to return the capitalization of a text with JavaScript −         ... Read More

How to search the querystring part of the href attribute of an area in JavaScript?

Ramu Prasad

Ramu Prasad

Updated on 23-Jun-2020 09:23:07

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

Set the full year for a specified date according to universal time.

Ramu Prasad

Ramu Prasad

Updated on 23-Jun-2020 08:16:39

118 Views

JavaScript date setUTCFullYear() method sets the full year for a specified date according to universal time.The following are the parameters for setUTCFullYear(yearValue[, monthValue[, dayValue]]) −yearValue − An integer specifying the numeric value of the year, for example, 2008.monthValue − An integer between 0 and 11 representing the months January through ... Read More

How to get the list of document properties which can be accessed using W3C DOM?

Ramu Prasad

Ramu Prasad

Updated on 23-Jun-2020 07:06:10

220 Views

The following are the document properties which can be accessed using W3C DOM −Sr.NoProperty & Description1BodyA reference to the Element object that represents the tag of this document.Ex − document.body2DefaultViewIts Read-only property and represents the window in which the document is displayed.Ex − document.defaultView3DocumentElementA read-only reference to the ... Read More

1 2 3 4 5 ... 7 Next
Advertisements