How to set a cookie and get a cookie with JavaScript?

Sreemaha
Published on 30-Jan-2018 11:48:29
Set CookieThe 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 or ... Read More

How to make text italic in HTML?

Lakshmi Srinivas
Published on 17-Jan-2018 13:14:05
To make text italic in HTML, use the <i>…</i> tag or <em>…</em> tag. Both the tags have the same functioning, but <em> tag is a phrase tag, which renders as emphasized text.Just keep in mind that you can get the same result in HTML with CSS font-style property.ExampleYou can try ... Read More

How to set JavaScript Cookie with no expiration date?

varma
Published on 30-Jan-2018 11:40:26
The expires option in a JavaScript cookie is optional. 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 or time and thereafter, the cookies' value will not be accessible.ExampleTo set JavaScript cookie with no ... Read More

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

usharani
Published on 30-Jan-2018 09:06:06
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 compare two strings using regex in Python?

Rajendra Dharmkar
Published on 08-Jan-2018 12:24:07
We can compare given strings using the following codeExampleimport re s1 = 'Pink Forest' s2 = 'Pink Forrest' if bool(re.search(s1,s2))==True:    print 'Strings match' else:    print 'Strings do not match'OutputThis gives the outputStrings do not match

How to make text bold in HTML?

Monica Mona
Published on 17-Jan-2018 12:37:52
To make text bold in HTML, use the <b>…</b> tag or <strong>…</strong> tag. Both the tags have the same functioning, but <strong> tag adds semantic strong importance to the text. The <b> tag is a physical markup element, but do not add semantic importance.Just keep in mind that you can ... Read More

How to set src to the img tag in html from the system drive?

Manikanth Mani
Published on 18-Jan-2018 06:19:25
To use an image on a webpage, use the <img> tag. The tag allows you to add image source, alt, width, height, etc. The src is to add the image URL. The alt is the alternate text attribute, which is text that is visible when the image fails to load.With ... Read More

How do I print Unicode characters in the console using JavaScript?

Amit Sharma
Published on 01-Feb-2018 10:22:56
Unicode has more than 1, 30, 000 characters. To print Unicode Characters in console, set the charset in a <meta> tag in the <head> tag −<meta charset="UTF-8">Here’s how you can add it −<script src="myscript.js" charset="utf-8"/>The above works on Chrome, Opera, and Firefox.Read More

How to set Heading alignment in HTML?

karthikeya Boyini
Published on 17-Jan-2018 12:34:14
Headings in HTML have 6 tags, <h1> to <h6>. To set the heading alignment in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <h1> to <h6> tag, with the CSS property text-align. HTML5 do not support ... Read More

How do I print a message to the error console using JavaScript?

Ali
Ali
Published on 01-Feb-2018 11:00:48
To print a message to the error console, use the console object. Here’s an example −The following will show a red error message −console.error(message);The following gives you the default message −console.log(message);The following gives you the warning message −console.warn(message);The following gives an information message −console.info(message);Add CSS to the log message −console.log('%c ... Read More
Advertisements