Category: javascript

What are the limitations of cookies?

{0 Comments}

This article contains the list of limitation which cookies do have. One of them is the limitation of domain it limited to one domain only. And only 20 cookies are allowed per domain. That really means cookies can only be read from the page of its own domain. Other limitation of the cookies is the …

Read More…

How to delete cookies in JavaScript

{0 Comments}

To delete cookies of a browser using JavaScript there are many ways which developer uses. Setting past date for expiry  One of popular practice is to overwrite the cookies expiration time and then set it some date that which have passed. So it will get removed after setting the session value to expired date. This …

Read More…

How to write cookies in JavaScript

{0 Comments}

Writing or setting the cookies using JavaScript is simple. You need use document.cookies command then after equal sign write cookies name and then cookies value after an equal operator as shown in the following code snippets  Javascript |  copy code |? 1Document.cookies=cookiesname=cookiesvalue;

Read More…

How to read cookies in JavaScript

{0 Comments}

To read cookies in a JavaScript following is the JavaScript function which will help you to read the particular cookies with the name which you have supplied in the function   Javascript |  copy code |? 01<script>02 03function readCookie(name) {04 05 var cookiename = name + "=";06 07 var ca = document.cookie.split(’;');08 09 for(var i=0;i < ca.length;i++)10 {11 12 var c = ca[i];13 14 while (c.charAt(0)==’ ‘) …

Read More…

How to find div height in JavaScript

{0 Comments}

To get the height of div in JavaScript following is the powerful JavaScript function I found on Google which is giving the result. So you can get the height of the div by using following function.    Javascript |  copy code |? 01function GetHeight() {02 var oDiv = document.getElementById("MyDiv");03 var sOriginalOverflow = oDiv.style.overflow;04 var sOriginalHeight = oDiv.style.height;05 oDiv.style.overflow = "";06 oDiv.style.height …

Read More…

How to find checkbox is checked in JavaScript

{0 Comments}

To find if checkbox is checked or not then you can use checked term with checkbox id can be use to get Boolean value the “true”,”false”. In following code sample there is a variable which get the Boolean value according the status of checkbox. So you can use following code sample to check if checkbox …

Read More…

How to find current URL in JavaScript

{0 Comments}

If you need to get url of the same page loading in JavaScript then document.URL will help you, this will return the only the current URL as implemented in following code snippets  Javascript |  copy code |? 1var text=document.URL;2 document.write(text);3 If above code is not helping you then you can use following code snippet. In which Window.location.href because I found …

Read More…

How to find current date in javascript

{0 Comments}

To find Current date using JavaScript you need to use Date inbuilt function. But the thing which you will notice is that, date you are getting by using inbuilt Date function is not in the correct format so you need to customize the JavaScript according to yourself. Which will give you date in proper format. …

Read More…

How to find a character in a string in JavaScript

{0 Comments}

There are two methods which is much more widely used in JavaScript to finding some character or part of string. This is CharAt and indexOF. CharAT CharAT is JavaScript method which will help you to get the character at particular position like at first, or eight places.  Thing to remember that here count starts from …

Read More…

How to find browser name/details in JavaScript

{0 Comments}

To get the browser detail you can use the some in built function to get the name, version, user agent and other value of the navigator. Among then the user agent property is more  reliable than appname property to get the following is the small syntax.  Javascript |  copy code |? 1var BrowserVersion = navigator.appVersion;2var Useragebt = navigator.userAgent;3var browserName = …

Read More…