Create Date Object

<script type=”text/javascript”> function toDate(dateStr) { var parts = dateStr.split(“-“); return new Date(parts[2], parts[1] – 1, parts[0]); } var dateObj=toDate(“23-02-2017”); var dateObj2=toDate(“1-2-2017”); alert(dateObj); alert(dateObj2); </script>

Javascript Prototype

Every JavaScript object has a prototype. The prototype is also an object. All JavaScript objects inherit their properties and methods from their prototype. JavaScript Prototypes All JavaScript objects inherit the properties and methods from their prototype. Objects created using an…

Google Map Autocomplete Address

Here is the complete code to add google map autocomplete search box. Generate Google key from the following URL : https://developers.google.com/maps/documentation/javascript/get-api-key Note:Replace googlekey in the below code with your genrated one <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <html…

Create and Get Cookie in Javascript/PHP

Creating Cookie in Javascript <script type=”text/javascript”> //create cookie function function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = “expires=”+d.toUTCString(); document.cookie = cname + “=” + cvalue + “; ” + expires + “;…

Page 2 of 212