Skip to main content

Posts

Showing posts from March, 2011

HTML Cheatsheet

Contents Basic Tags Body Attributes Text Tags Links Formatting Tables Table Attributes Frames Frames Attributes Forms Basic Tags <html></html>  Creates an HTML document <head></head>  Sets off the title and other information that isn’t displayed on the web page itself <body></body>  Sets off the visible portion of the document Body Attributes <body bgcolor="pink">  Sets the background color, using name or hex value <body text="black">  Sets the text color, using name or hex value <body link="blue">  Sets the color of links, using name or hex value <body vlink="#ff0000">  Sets the color of followed links, using name or hex value <body alink="#00ff00">  Sets the color of links on click <body ondragstart="return false" onselectstart="return false">  Disallows text selection with the mouse and keyboard Text Ta...

[PHP, Javascript] Detecting User Time Zone of a user

var now = new Date(); var later = new Date(); // Set time for how long the cookie should be saved later.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000); // Set cookie for the time zone offset in minutes setCookie("time_zone_offset", now.getTimezoneOffset(), later, "/"); // Create two new dates var d1 = new Date(); var d2 = new Date(); // Date one is set to January 1st of this year // Guaranteed not to be in DST for northern hemisphere, // and guaranteed to be in DST for southern hemisphere // (If DST exists on client PC) d1.setDate(1); d1.setMonth(1); // Date two is set to July 1st of this year // Guaranteed to be in DST for northern hemisphere, // and guaranteed not to be in DST for southern hemisphere // (If DST exists on client PC) d2.setDate(1); d2.setMonth(7); // If time zone offsets match, no DST exists for this time zone if(parseInt(d1.getTimezoneOffset())==parseInt(d2.getTimezoneOffset())) { setCookie("time_zone_dst", ...