Seetha has Published 86 Articles

How to set cookies to expire in 1 hour in JavaScript?

seetha

seetha

Updated on 16-Jun-2020 11:47:42

8K+ Views

You can extend the life of a cookie beyond the current browser session by setting an expiration date and saving the expiry date within the cookie. This can be done by setting the ‘expires’ attribute to a date and time.ExampleYou can try to run the following example to set cookies ... Read More

What is the difference between static classes and non-static inner classes in Java?

seetha

seetha

Updated on 16-Jun-2020 09:10:13

674 Views

Following are the notable differences between inner classes and static inner classes.Accessing the members of the outer classThe static inner class can access the static members of the outer class directly. But, to access the instance members of the outer class you need to instantiate the outer class.Examplepublic class Outer ... Read More

Preventing an image from being draggable or selectable in HTML without using JS

seetha

seetha

Updated on 01-Jun-2020 10:44:14

8K+ Views

Add the following code snippet to image properties, and prevent images from being dragged and selected.img {      user-drag: none;      user-select: none;    -moz-user-select: none;    -webkit-user-drag: none;    -webkit-user-select: none;    -ms-user-select: none; }On double click on a text or image, it is highlighted (selected). The ... Read More

How do we add a sample computer code in HTML?

seetha

seetha

Updated on 29-May-2020 23:04:24

82 Views

Use the tag to display a sample computer code. The HTML tag is used to display the output of a computer program.ExampleYou can try to run the following code to implement tag in HTML −           HTML samp Tag               The header file always starts with #include.    

How do we use a simple drop-down list of items in HTML forms?

seetha

seetha

Updated on 12-May-2020 08:16:56

11K+ Views

With HTML, you can create a simple drop-down list of items to get user input in HTML forms. A select box also called drop-down box provides an option to list down various options in the form of drop-down list, from where a user can select one or more options. The ... Read More

Get the HTTP header for the information of the content attribute in HTML

seetha

seetha

Updated on 03-Mar-2020 12:35:54

217 Views

Use the http-equiv attribute to get the HTTP header for the information of the content attribute in HTML.ExampleYou can try to run the following code to implement http-equiv attribute −           HTML http-equiv attribute                                 Document content goes here    

How to specify that the styles only apply to this element's parent element and that element's child elements in HTML?

seetha

seetha

Updated on 03-Mar-2020 11:09:27

162 Views

Use the scoped attribute to specify that the styles only apply to the parent element and the element’s child elements −Example                    h2 {             color:yellow;          }                                           h2 {                color:grey;             }                    Grey Heading             Yellow Heading    

Execute a script when the browser starts to work offline in HTML?

seetha

seetha

Updated on 03-Mar-2020 07:31:19

151 Views

When the web browser starts to work offline, the onoffline attribute triggers. You can try to run the following code to implement onoffline attribute −Example                    function onlineFunc() {             alert ("Working online!");         ... Read More

How to print a byte array in Java?

seetha

seetha

Updated on 24-Feb-2020 11:18:02

14K+ Views

You can simply iterate the byte array and print the byte using System.out.println() method.Examplepublic class Tester {    public static void main(String[] args) {       byte[] a = { 1,2,3};       for(int i=0; i< a.length ; i++) {          System.out.print(a[i] +" ");       }    } }Output1 2 3

Convert bytes to a string in java

seetha

seetha

Updated on 24-Feb-2020 10:26:35

413 Views

Use String(byte[]) constructor to convert byte[] to String.Examplepublic class Tester {    public static void main(String[] args) {       String test = "I love learning Java";       byte[] bytes = test.getBytes();       String converted = new String(bytes);       System.out.println(converted);    } }OutputI love learning Java

Previous 1 ... 3 4 5 6 7 ... 9 Next
Advertisements