Write the syntax of javascript with a code to demonstrate it?

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

118 Views

JavaScript TagsThe html script tag wants the browser to get a script between them. We can expect the scripts to be in the following places. 1.The script can be placed in html's head tag 2.Within Html's body tag. 3.As an external file. Most importantly client side scripts such as JavaScript are placed in script tags.demonstration code  Live Demo This example writes "JavaScript is not java" into an HTML element with id="script"    document.getElementById("imp").innerHTML = "JavaScript is not java"; OutputThis example writes "JavaScript is not java" into an HTML element with id="script" JavaScript is not javaExplanationEvery JavaScript code should be in ... Read More

How to arrange components in a FlowLayout to be left-justified in Java?

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

205 Views

Use FlowLayout.LEFT to arrange components in a FlowLayout to be left-justified. The following is an example to arrange components in a FlowLayout to be left-justified −Examplepackage my; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.WindowConstants; public class SwingDemo {    public static void main(String[] args) {       JFrame frame = new JFrame("Internet Language");       frame.setLayout(new FlowLayout(FlowLayout.LEFT));       JLabel label = new JLabel("Top Internet Language");       label.setPreferredSize(new Dimension(240, 70));       label.setOpaque(true);       label.setBackground(Color.RED);       label.setForeground(Color.WHITE);       Font ... Read More

How can I view the indexes I have set up in MySQL?

George John
Updated on 30-Jul-2019 22:30:26

68 Views

To view the indexes, you can use SHOW command.Following is the syntax −show index from yourTableName;Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    FirstName varchar(20),    LastName varchar(20)    ); Query OK, 0 rows affected (0.46 sec)Following is the query to create an index −mysql> create index id_FirstName on DemoTable(Id, FirstName); Query OK, 0 rows affected (0.52 sec) Records : 0 Duplicates : 0 Warnings : 0Following is the query to view the indexes I have set up in MySQL −mysql> show index from DemoTable;This will produce ... Read More

HTML download Attribute

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

112 Views

The download attribute of the element is used to set the name of the file to be downloaded which would download when user clicks on the hyperlink.Following is the syntax −The file is the name of the file set for download.Let us now see an example to implement the download attribute of the element −Example Live Demo Learning Learn these technologies with ease.... OutputNow, when you will click on let’s say “PERL”, the file will download as shown below −Above, we ... Read More

HTML DOM Input Month form Property

Sharon Christine
Updated on 30-Jul-2019 22:30:26

63 Views

The HTML DOM input month form property returns the reference of the form that contains the month input field in the HTML document.SyntaxFollowing is the syntax −object.formExampleLet us see an example of HTML DOM input month form property − Live Demo    body{       text-align:center;       background-color:#363946;       color:#fff;    }    form{       margin:2.5rem auto;    }    button{       background-color:#db133a;       border:none;       cursor:pointer;       padding:8px 16px;       color:#fff;       border-radius:5px;     ... Read More

HTML DOM Subscript Object

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

60 Views

The HTML DOM Subscript Object represent the element of an HTML document.Let us see how to create subscript objectSyntaxFollowing is the syntax −document.createElement(“SUB”);ExampleLet us see an example of HTML DOM subscript object − Live Demo    body {       text-align: center;       background-color: #fff;       color: #0197F6;    }    h1 {       color: #23CE6B;    }    .btn {       background-color: #fff;       border: 1.5px dashed #0197F6;       height: 2rem;       border-radius: 2px;       width: 60%;     ... Read More

HTML DOM Link type Property

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

78 Views

The Link type property sets/returns the type of a linked document.SyntaxFollowing is the syntax −Returning type attribute valuelinkObject.typeSetting type to a valid valuelinkObject.type = valueNOTE  − valid values include "text/javascript", "text/css", "image/gif", etc.ExampleLet us see an example for Link type property − Link type Link-type    var divDisplay = document.getElementById("divDisplay");    var extStyle = document.getElementById("extStyle");    divDisplay.textContent = 'The linked document type: '+extStyle.type+' is not compatible';    function correctType(){       extStyle.type = 'text/css';       divDisplay.textContent = 'Congrats! The linked document type: '+extStyle.type+' is compatible'; ... Read More

C++ Program to Find the Shortest Supersequence that Contains Two or more Sequences as Subsequences

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

106 Views

Here we shall discuss a C++ Program to find the Shortest Supersequence that contains two or more Sequences as Subsequences.AlgorithmBegin    function ShortestSubSeq() returns supersequence of A and B:    1) Declare an array ss[i][j] which contains length of shortest supersequence for A[0 .. i-1] and B[0 .. j-1].    2) Find the length of the possible supersequence in bottom up manner using recursion.    3) Declare an array ss[i][j] which stores length of shortest supersequence for A[0 .. i-1] and B[0 .. j-1] in index.    4) Declare a string s to store the shortest subsequence.    5) Initialize ... Read More

Token Bus and Token Ring

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

21K+ Views

Token RingToken ring (IEEE 802.5) is a communication protocol in a local area network (LAN) where all stations are connected in a ring topology and pass one or more tokens for channel acquisition. A token is a special frame of 3 bytes that circulates along the ring of stations. A station can send data frames only if it holds a token. The tokens are released on successful receipt of the data frame.Token Passing Mechanism in Token RingIf a station has a frame to transmit when it receives a token, it sends the frame and then passes the token to the ... Read More

How to set the text of the JLabel to be right-justified and vertically centered in Java?

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

470 Views

To set the text of the label component to be right- justified and vertically centered, you need to set the alignment while creating a new label.Set the label to be on the right -JLabel label = new JLabel("Name", JLabel.RIGHT);Here, we have set the size of the label as well as the color that includes foreground and background color -label.setPreferredSize(new Dimension(170, 70)); label.setOpaque(true); label.setBackground(Color.MAGENTA); label.setForeground(Color.WHITE);The following is an example to set the text of the label to be right-justified and vertically centered −Examplepackage my; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.WindowConstants; public ... Read More

Advertisements