Ramu Prasad has Published 74 Articles

How to add a variable in HTML?

Ramu Prasad

Ramu Prasad

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

21K+ 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

16K+ 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

604 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

312 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

78 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

127 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

92 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

51 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

133 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

How to reduce the number of errors in scripts?

Ramu Prasad

Ramu Prasad

Updated on 23-Jun-2020 07:03:36

122 Views

To reduce the number of errors in scripts, follow the below-given tips −Use plenty of comments. Comments enable you to explain why you wrote the script the way you did and to explain particularly difficult sections of code.Always use indentation to make your code easy to read. Indenting statements also ... Read More

1 2 3 4 5 ... 8 Next
Advertisements