Recent Notes

Displaying keyword search results 1 - 10
Created by Dr. Xi on February 13, 2012 20:59:35    Last update: February 13, 2012 20:59:54
The insertAttribute tag allows you to have a body as well as specify a default value, but both values are scriptless , i.e., scriptlet is not allowed in body: <tiles:insertAttribute name="javascript"> <scri... and defaultValue is output literally: <tiles:insertAttribute name="javascript" de... And, <put-attribute> in tiles definition does not replace the body of <tiles:insertAttribute> , it appends to the body!
Created by James on March 03, 2011 20:50:51    Last update: March 03, 2011 20:51:54
This function parses the querystring and returns the query parameters as a map. It calls the string replace function with a function replacement and uses the side effects of the replacement function call to populate the parameter map. function getQueryParameters() { var result ...
Created by James on March 03, 2011 20:29:52    Last update: March 03, 2011 20:30:36
The general syntax for JavaScript string replace is: str.replace(regexp|substr, newSubStr|function[, |n... i.e., The substring to be replaced can be either a string or a regular expression (regex) The replacement string can be a string, or a function which returns the replacement. If the second parameter is a function, the function will be invoked after the match has been performed. The parameters passed to the function are: the matched (to be replaced) substring, the parenthesized submatch strings, offset of the match, and the whole string on which replace is being called. It can take an optional flags argument, but that's not standard . Examples: // replace apples with oranges // only the ...
Created by Dr. Xi on October 26, 2010 04:47:37    Last update: January 11, 2011 20:00:36
The code presented here is a simple implementation of a tab set. It is used to demo how a tab set could be implemented. The code is stand alone and does not depend on any JavaScript libraries. Multiple tab sets within the same page is supported. The HTML markup is fairly simple: Tabs sets are contained within a DIV element with class name "tabsContainer". Define a UL list for the tabs. Follow the UL list with equal number of DIVs for the tab contents. The Nifty Corners Cube technique is used to draw the rounded corners (original form, not the enhanced JavaScript form). HTML, CSS and JavaScript: <!doctype html> <html> <head> <style typ...
Created by Dr. Xi on September 11, 2008 22:55:01    Last update: January 11, 2011 19:48:19
<html> <head> <script language="JavaScript">...
Created by James on October 15, 2010 20:10:26    Last update: October 15, 2010 20:10:26
Download the Cufon Javascript and save it as cufon-yui.js . Generate the font JavaScript and save it as myfont.js (upload the font file through http://cufon.shoqolate.com/generate/ ). Add these lines to the header element: <script type="text/javascript" src="cufon-yui.js">... Replace selected elements with JavaScript like this: <script type="text/javascript"> Cufon.rep... Full HTML page: <!DOCTYPE html> <html> <head> <title>C... Reference: Cufonize Your Pages – How to add Cufon to your Web Design
Created by Dr. Xi on September 11, 2008 23:06:18    Last update: October 06, 2010 03:16:13
Firefox and Google chrome has native support for the trim function for a String. IE (as of IE 8.0) does not provide a trim function for String. Using the JavaScript Executor , if you execute: 'abcd '.trim you get: function trim() { [native code] } in Firefox and Google Chrome. But you get nothing in IE. If you try to execute the trim method on a String: 'abcd '.trim() you get this in IE: TypeError: Object doesn't support this property or... In order to have the trim function across all browsers, define this function: if(typeof String.prototype.trim !== 'function') { ... Or, if you use jQuery, you can use $.trim()
Created by James on September 03, 2010 20:43:28    Last update: September 03, 2010 20:43:48
Match a regex: 'Free online videos for $.10 each'.match(/each$/);... Search for a regex pattern: 'Jack Jake Jason'.search(/son/); // 12 Replace by regex match: 'Jack Jake Jason'.replace(/.a/g, 'Ma'); // Mack... Split by regex: 'She sells seashells by the seashore'.split(/\s/);...
Created by woolf on February 03, 2010 04:15:33    Last update: February 03, 2010 04:15:33
The replace method for JavaScript strings can either replace a string or a regular expression: // replace string with string 'ActionScript'.re...
Created by James on August 09, 2009 03:57:04    Last update: August 09, 2009 03:57:04
Contrary to some online documentation, JavaScript does not seem to support the functions startsWith , endsWith etc. This snippet adds these functions. String.prototype.endsWith = function (a) { ...
Previous  1 2 Next