Ramu Prasad

Ramu Prasad

48 Articles Published

Articles by Ramu Prasad

48 articles

How to redirect to another webpage using JavaScript?

Ramu Prasad
Ramu Prasad
Updated on 20-Apr-2022 22K+ 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 the URL (href) of the current page.window.location.replace()- it replaces the current document with new document.window.location.assign() loads a new document.The syntaxes below are used to redirect to another web page. We omit the window prefix and use only location in all the program examples. You can try running the programs using ...

Read More

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

Ramu Prasad
Ramu Prasad
Updated on 24-Jun-2020 493 Views

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

Read More

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

Ramu Prasad
Ramu Prasad
Updated on 23-Jun-2020 190 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( $ ) {    // }

Read More

How to set the capitalization of a text with JavaScript?

Ramu Prasad
Ramu Prasad
Updated on 23-Jun-2020 261 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 −           Capitalize Text                This is demo text! This is demo text!                      function display() {             document.getElementById("myID").style.textTransform = "capitalize";          }          

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

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 254 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 tag of the document.Ex − document.documentElement8/31/20084ImplementationIt is a read-only property and represents the DOMImplementation object that represents the implementation that created this document.Ex − document.implementation

Read More

How to reduce the number of errors in scripts?

Ramu Prasad
Ramu Prasad
Updated on 23-Jun-2020 268 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 make it easier for you to match up the beginning and ending tags, curly braces, and other HTML and script elements.Write modular code. Whenever possible, group your statements into functions. Functions let you group related statements, and test and reuse portions of code with minimal effort.Be consistent in the way you ...

Read More

How can we fetch a second highest salary of an employee from a MySQL table?

Ramu Prasad
Ramu Prasad
Updated on 22-Jun-2020 300 Views

To understand this concept, we are using the data from table ‘Salary’ as follows −mysql> Select * from Salary; +--------+--------+ | Name   | Salary | +--------+--------+ | Gaurav |  50000 | | Rahul  |  40000 | | Ram    |  45000 | | Raman  |  45000 | +--------+--------+ 4 rows in set (0.00 sec) mysql> Select * from salary12345 order by salary DESC limit 1 offset 1; +-------+--------+ | name  | Salary | +-------+--------+ | Raman |  45000 | +-------+--------+ 1 row in set (0.00 sec)

Read More

What is the use of ‘c’ option while writing MySQL statements?

Ramu Prasad
Ramu Prasad
Updated on 22-Jun-2020 583 Views

‘\c’ option means ‘clear’ and is used to clear the current input. Suppose if we do not want to execute a command that we are entering, then we can use a clear \c option which clears the current input. For example, the use of \c option can be done as follows −mysql> Select *     -> from\cIn the example above, when we use \c in a statement, MySQL clears the current input and returns back to the MySQL prompt for accepting other statements.

Read More

How can we run a MySQL statement without termination semicolon?

Ramu Prasad
Ramu Prasad
Updated on 22-Jun-2020 491 Views

With the help of \G or \g option just at the end of the MySQL statement, we can run it without the semicolon. Consider the example below −mysql> Select * from Stock_item\G *************************** 1. row *************************** item_name: Calculator     Value: 15  Quantity: 89 *************************** 2. row *************************** item_name: Notebooks     Value: 63  Quantity: 40 *************************** 3. row *************************** item_name: Pencil     Value: 15  Quantity: 40 *************************** 4. row *************************** item_name: Pens   Value : 65 Quantity: 32 *************************** 5. row *************************** item_name: Shirts     Value: 13  Quantity: 29 *************************** 6. row *************************** item_name: Shoes     ...

Read More
Showing 1–10 of 48 articles
« Prev 1 2 3 4 5 Next »
Advertisements