HTML DOM S Object

AmitDiwan
Updated on 30-Jul-2019 22:30:26

63 Views

The HTML DOM S Object represent the element of an HTML document.Let us create an s object −SyntaxFollowing is the syntax −document.createElement(“S”);ExampleLet us see an example of s object − Live Demo    body{       text-align:center;       background-color:#fff;       color:#0197F6;    }    h1{       color:#23CE6B;    }    .drop-down{       width:35%;       border:2px solid #fff;       font-weight:bold;       padding:8px;    }    .btn{       background-color:#fff;       border:1.5px dashed #0197F6;       height:2rem;       ... Read More

How to filter non-null value in Java?

Nancy Den
Updated on 30-Jul-2019 22:30:26

1K+ Views

Let’s say the following is our List with string elements:List leagues = Arrays.asList("BBL", "IPL", "MLB", "FPL", "NBA", "NFL");Now, create a stream and filter elements that end with a specific letter:Stream stream = leagues.stream().filter(leagueName -> leagueName.endsWith("L"));Now, use Objects::nonnull for non-null values:List list = stream.filter(Objects::nonNull).collect(Collectors.toList());The following is an example to filter non-null value in Java:Exampleimport java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; import java.util.stream.Stream; public class Demo {    public static void main(String[] args) {       List leagues = Arrays.asList("BBL", "IPL", "MLB", "FPL", "NBA", "NFL");       Stream stream = leagues.stream().filter(leagueName -> leagueName.endsWith("L"));       List list = ... Read More

C++ Program to Find the Longest Prefix Matching of a Given Sequence

Anvi Jain
Updated on 30-Jul-2019 22:30:26

427 Views

Here we shall discuss a C++ program to find the Longest Subsequence Common to All Sequences in a Set of Sequences.AlgorithmsBegin Take the array of strings as input. function matchedPrefixtill(): find the matched prefix between string s1 and s2 :    n1 = store length of string s1.    n2 = store length of string s2.    for i = 0, j = 0 to i

What are the types of tags involved in javascript?

vineeth.mariserla
Updated on 30-Jul-2019 22:30:26

956 Views

Html taga) The tag is used to define a client-side script.b) The tag  contains scripting statements or an external script file.JavaScript code must be keep in script tag.Let's see the use of the tag. For suppose declare the variable outside the script tag. Live DemoExample var a = 1;    var b = 2;    var c = a + b; document.getElementById("tag").innerHTML = c; Outputvar a = 1For suppose, let the variable be declared inside the script tag. Live DemoExample    var a = 1;    var b = 2;    var c = a + b; document.getElementById("tag").innerHTML = c; Output3

How can I position JButtons vertically one after another in Java Swing?

Chandu yadav
Updated on 30-Jul-2019 22:30:26

443 Views

Position buttons vertically one after another using the Box class. Use the createVerticalBox() method that displays components from top to bottom −JButton button1 = new JButton("One"); JButton button2 = new JButton("Two"); JButton button3 = new JButton("Three"); Box box = Box.createVerticalBox(); box.add(button1); box.add(button2); box.add(button3);The following is an example to position buttons vertically one after another −Examplepackage my; import javax.swing.Box; import javax.swing.JButton; import javax.swing.JFrame; public class SwingDemo {    public static void main(String[] args) {       JButton button1 = new JButton("One");       JButton button2 = new JButton("Two");       JButton button3 = new JButton("Three");       ... Read More

Concatenate two tables in MySQL with a condition?

Ankith Reddy
Updated on 30-Jul-2019 22:30:26

454 Views

To concatenate two tables, UNION ALL in MySQL. Let us create a table −mysql> create table DemoTable1    (    Id int,    FirstName varchar(20)    ); Query OK, 0 rows affected (1.52 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values(10, 'John'); Query OK, 1 row affected (0.28 sec) mysql> insert into DemoTable1 values(20, 'Carol'); Query OK, 1 row affected (0.28 sec)Display all records from the table using select statement −mysql> select *from DemoTable1;Output+------+-----------+ | Id | FirstName | +------+-----------+ | 10 | John | ... Read More

Pointers, smart pointers and shared pointers in C++

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26

4K+ Views

PointersPointers are used to store the address of variable.SyntaxType *pointer;InitializationType *pointer; Pointer = variable name;Functionspointers are used to store address of variable.pointers can have a null value assigned.pointer can be referenced by pass by reference.a pointer has its own memory address and size on the stack.Example Live Demo#include using namespace std; int main() {    // A normal integer variable    int a = 7;    // A pointer variable that holds address of a.    int *p = &a;    // Value stored is value of variable "a"    cout

How do we copy objects in java?

Venkata Sai
Updated on 30-Jul-2019 22:30:26

8K+ Views

In Java you can copy an object in several ways, among them, copy constructor and the clone method are the mostly used.Using copy constructorGenerally, the copy constructor is a constructor which creates an object by initializing it with an object of the same class, which has been created previously. Java does support for copy constructors but you need to define them yourself.ExampleIn the following Java example, we a have a class with two instance variables name and age and a parameterized constructor initializing these variables.Then, we have another constructor which accepts an object of the current class and initializes the ... Read More

HTML DOM Input Number stepUp() Method

karthikeya Boyini
Updated on 30-Jul-2019 22:30:26

66 Views

The DOM input number stepUp() method increments the value of input number field by a specified value.SyntaxFollowing is the syntax −object.stepUp(number)Here, if number parameter is omitted then it increments the value by 1.ExampleLet us see an example of HTML DOM input number stepUp() method − Live Demo HTML DOM stepUp()/stepDown() Demo    body{       text-align:center;       background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%)       center/cover no-repeat;       height:100vh;       color:#fff;    }    p{       font-size:1.5rem;    }    input{       width:40%; ... Read More

HTML DOM links Collection

AmitDiwan
Updated on 30-Jul-2019 22:30:26

119 Views

The links Collection returns a list/collection of all the links corresponding to and/or elements.SyntaxFollowing is the syntax −Returning links collectiondocument.linksPropertiesHere, “links” collection can have the following properties and methods −Property/MethodDescriptionlengthIt returns the number of  and  elementsnamedItem()It returns the  or/and  element with the specified idExampleLet us see an example for links collection length property − Live Demo Links Collection length    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {   ... Read More

Advertisements