Sravani S has Published 79 Articles

What is the usage of the onbeforeunload event in JavaScript?

Sravani S

Sravani S

Updated on 21-May-2020 07:47:23

174 Views

If you want to trigger an event before the document is loaded, then use the onbeforeunload event.ExampleYou can try to run the following code to learn how to implement onbeforeunload event in JavaScript.           Click to open Qries                function myFunction() {             return "Working with onbeforeunload event";          }          

How to define a Regular Expression in JavaScript?

Sravani S

Sravani S

Updated on 19-May-2020 11:07:45

166 Views

A regular expression is an object that describes a pattern of characters.The JavaScript RegExp class represents regular expressions, and both String and RegExp define methods that use regular expressions to perform powerful pattern-matching and search-and-replace functions on the text. A regular expression could be defined with the RegExp () constructor, ... Read More

How do I loop through a JSON file with multiple keys/sub-keys in Python?

Sravani S

Sravani S

Updated on 05-Mar-2020 08:14:19

14K+ Views

You can parse JSON files using the json module in Python. This module parses the json and puts it in a dict. You can then get the values from this like a normal dict. For example, if you have a json with the following content −{    "id": "file",   ... Read More

How to specify a minimum value in HTML?

Sravani S

Sravani S

Updated on 03-Mar-2020 10:21:41

149 Views

Use the min attribute to add the minimum value in HTML. You can try to run the following code to implement min attribute −Example                    Rank:                              

Execute a script when a mouse pointer moves out of an element in HTML?

Sravani S

Sravani S

Updated on 03-Mar-2020 07:29:53

131 Views

When the mouse pointer moves out of an element, the onmouseout attribute triggers. You can try the following code to implement onmouseout attribute −Example                    This is demo heading.             Click above and then release.                function mouseOut() {             document.getElementById("myid").style.color = "red";          }          

How to identify that the track is to be enabled if the user's preferences do not indicate that another track would be more appropriate in HTML?

Sravani S

Sravani S

Updated on 03-Mar-2020 05:28:15

83 Views

Use the default attribute to identify that the track is to be enabled, if you’re providing with two subtitle tracks for the video.ExampleYou can try the following code to implement the default attribute for tracks −                                                            Your browser does not support the video element.          

Converting Strings to Numbers and Vice Versa in Java.

Sravani S

Sravani S

Updated on 26-Feb-2020 09:51:01

2K+ Views

Java lang package provides Integer class which has methods to convert an integer to String and vice versa. You can convert a String to an integer using the parseInt() method and Integer to String using the toString() method.ExampleLive Demopublic class Sample {    public static void main(String args[]){       ... Read More

How to Split a String with Escaped Delimiters?

Sravani S

Sravani S

Updated on 26-Feb-2020 09:42:44

439 Views

The split(String regex) method of the String class splits this string around matches of the given regular expression.ExampleLive Demopublic class Sample{    public static void main(String args[]){       String s = "|A|BB||CCC|||";       String[] words = s.split("\|");       for (String string : words) {          System.out.println(string);       }    } }OutputA BB CCC

Search and Replace with Java regular expressions

Sravani S

Sravani S

Updated on 26-Feb-2020 08:09:33

1K+ Views

Java provides the java.util.regex package for pattern matching with regular expressions. Java regular expressions are very similar to the Perl programming language and very easy to learn.A regular expression is a special sequence of characters that help you match or find other strings or sets of strings, using a specialized ... Read More

What does the method indexOf(obj o) do in java?

Sravani S

Sravani S

Updated on 20-Feb-2020 12:19:30

155 Views

The indexOf(Object) method of the java.util.ArrayList class returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.Exampleimport java.util.ArrayList; public class ArrayListDemo {    public static void main(String[] args) {       ArrayList arrlist = new ... Read More

Advertisements