Usharani has Published 76 Articles

How to get a pseudo-random number between 0 and 1 in JavaScript?

usharani

usharani

Updated on 19-Jun-2020 07:53:05

411 Views

To get a pseudo-random number between 0 and 1, use the Math.random() method in JavaScript.ExampleYou can try to run the following code to get a pseudo-random number between 0 and 1 −           JavaScript Math random() Method                 ... Read More

How to clear HTML form fields with jQuery?

usharani

usharani

Updated on 17-Jun-2020 13:54:32

2K+ Views

With jQuery, you can easily clear HTML form fields. For this, jQuery: reset Selector is used. This will clear the HTML form fields.ExampleYou can try to run the following code to clear form fields with jQuery −Live Demo                   ... Read More

Exception handling with method overriding in Java.

usharani

usharani

Updated on 17-Jun-2020 07:10:18

4K+ Views

Yes, we can override a method by changing only the exception handling in java pertaining the following rule −An overriding method can throw any unchecked exceptions, regardless of whether the overridden method throws exceptions or not. However, the overriding method should not throw checked exceptions that are new or broader ... Read More

How to use “window.print()” function to print a page?

usharani

usharani

Updated on 16-Jun-2020 13:25:14

1K+ Views

To print a page in JavaScript, use the window.print() method. It opens up the standard dialog box, through which you can easily set the printing options like which printer to select for printing.ExampleYou can try to run the following code to learn how to print a page −Live Demo ... Read More

What is the difference between void, eval, and the Function constructor in JavaScript?

usharani

usharani

Updated on 16-Jun-2020 13:12:48

346 Views

The void keywordThe void is an important keyword in JavaScript, which can be used as a unary operator that appears before its single operand, which may be of any type. This operator specifies an expression to be evaluated without returning a value.The syntax of the void can be either of ... Read More

How do I create and read a value from the cookie in JavaScript?

usharani

usharani

Updated on 16-Jun-2020 11:50:52

181 Views

Create cookiesThe simplest way to create a cookie is to assign a string value to the document.cookie object, which looks like this −document.cookie = "key1=value1;key2=value2;expires=date";Here the “expires” attribute is optional. If you provide this attribute with a valid date or time, then the cookie will expire on a given date ... Read More

How to call a JavaScript function from an onsubmit event?

usharani

usharani

Updated on 16-Jun-2020 11:37:14

2K+ Views

The onsubmit event occurs when you try to submit a form. You can put your form validation against this event type. The following example shows how to use onsubmit. Here, we are calling a validate() function before submitting a form data to the webserver. If validate() function returns true, the ... Read More

What are Java parent and child classes in Java?

usharani

usharani

Updated on 16-Jun-2020 08:47:34

17K+ Views

Java supports inheritance, an OOPs concept where one class acquires the members (methods and fields) of another.You can inherit the members of one class from another, use the extends keyword as:class A extends B{}The class which inherits the properties of other is known as child class (derived class, sub class) ... Read More

How to use labels in Java code?

usharani

usharani

Updated on 16-Jun-2020 06:29:04

11K+ Views

Java provides two types of branching/control statements namely, break and continue.The break statementThis statement terminates the loop or switch statement and transfers execution to the statement immediately following the loop or switch.ExampleFollowing is the example of the break statement. Here we are trying to print elements up to 10 and, ... Read More

How to programmatically empty browser cache with HTML?

usharani

usharani

Updated on 01-Jun-2020 10:53:08

2K+ Views

You can tell your browser not to cache your page by using the following meta tags − In addition, try the following:  Append a parameter/string to the filename in the script tag. Change it when the file changes.Then the next time you update the file, just update the version i.e.Read More

Advertisements