Category: javascript
-
JQuery – Alternatives and Drop-In Replacement of jQuery JavaScript Library
The following small javascript libraries can be used instead of and as drop-in replacements of jQuery. My favorites (based on size and/or functionality) [github file = “/sudar/MissileLauncher/blob/master/MissileLauncher.cpp”] 1. ki.js: https://github.com/dciccale/ki.js 2. minifiedjs: http://minifiedjs.com/ 3. psQuery: https://github.com/pseudosavant/psQuery 4. Zepto.js: Zepto.js 5. riloadr: riloadr References 1. http://microjs.com/
-
JavaScript – Get Stack Trace as String
public static String getStackTrace(Throwable e){ StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); String stacktrace = sw.toString(); return stacktrace; }
-
JavaScript – Simple Helper Functions
Get an HTML object element function el(elementId){ var elementObject = null; try{ elementObject = document.all ? document.all[elementId] : document.getElementById(elementId); }catch(e){ // nothing to do } return elementObject; } Trim a string function trim(str) { return str.replace(/^\s*|\s*$/g,””); } Set focus on an HTML object element function focusElement(elementId){ try{ el(elementId).focus(); }catch(e){} } Move an HTML object element…
-
JavaScript – Check if HTML Links is visited or not
UPDATE: Code no longer works accross all browser. The reason is pretty clear – History Theft ! function hasLinkBeenVisited(url) { var link = document.createElement(‘a’); link.href = url; document.body.appendChild(link); if (link.currentStyle) { //IE var color = link.currentStyle.color; //alert(“[IE] url:”+url+”, color:”+color) if (color == ‘#800080’){ return true; } } else { // Firefox link.setAttribute(“href”,url); var computed_style =…
-
CSS – Styling HTML Links – removing underline
Simple Link styling Link: This Link to Google is Red Code: Link: This Link to Google is Red Link styling for visited links Link: This Link to my Blog is always Green Code: In order to make sure that the link color “sticks” even for visited links, use the following CSS. Link: This Link to…
-
JavaScript – Check and uncheck Checkboxes
Choose Your Favorite Programming Languages Java Python PHP HTML JavaScript SQL | Code: Your Favorite Scripts & Languages Java Python PHP HTML JavaScript SQL |