Recent Notes

Displaying keyword search results 1 - 9
Created by James on October 25, 2011 19:44:30    Last update: October 25, 2011 19:45:40
jQuery automatically maps HTML5 custom data attributes to data storage associated with the data() method. Here's an example: <html> <head> <script type="text/javascript"...
Created by James on October 11, 2010 19:01:28    Last update: January 11, 2011 20:38:56
Test page (click the "new window" icon to see the transition): <!DOCTYPE html> <html> <head> <title>jQu...
Created by James on October 11, 2010 18:14:41    Last update: January 11, 2011 20:36:01
Test page: <!DOCTYPE html> <html> <head> <title>jQu... Documentation: UI/Effects - jQuery JavaScript Library Effects - jQueryAPI
Created by James on September 10, 2010 23:01:14    Last update: September 10, 2010 23:01:14
By default, heights for jQuery UI tab panels expand or contract depending on the height of each tab. The code snippet here sets the height of all tabs to be equal to that of the container. <!DOCTYPE html> <html> <head> <title>jQu...
Created by James on June 30, 2010 19:04:45    Last update: July 03, 2010 21:24:33
Technically, file upload cannot be handled by Ajax, because XMLHttpRequest (XHR) does not handle file inputs. All techniques not using Flash rely on an invisible iframe as the upload form submit target. JavaScript then grabs the response content from the iframe and present it, giving the same illusion as Ajax. webtoolkit AIM The technique by webtoolkit is very simple. It involves 3 simple steps: include the AIM script, implement the start/finish JavaScript functions, and add an onsubmit handler to the normal file upload form. The hooked up form looks like: <head> <script type="text/javascript" src="webt... The AIM script is also quite simple: /** * * AJAX IFRAME METHOD (AIM) * http... The above code only supports HTML responses. In order to support JSON responses, the above...
Created by James on June 30, 2010 20:14:28    Last update: July 03, 2010 18:41:12
The HTML page <!DOCTYPE html> <html> <head> <title>jQu... Client Side Code // called before upload submit function sta... Server Side Code Using Apache Commons FileUpload as example. Upload code (responds to fileUpload.do ): final HttpSession session = httpServletRequest... Progress code (responds to uploadProgress.do ): HttpSession session = httpServletRequest.getSe...
Created by James on July 05, 2009 02:21:15    Last update: July 05, 2009 02:25:20
This is a JavaScript wrapper for Bare Naked App's progress bar. As usual, download their images and add this to the CSS: img.progressBar { background: white url(images... Then, add my JavaScript function, which takes a parent HTML element as input and returns the progress bar object with a setValue method: function createProgressBar(elem) { var img = d... Test code: <html> <head> <!-- setup code START --> ...
Created by James on May 23, 2009 19:46:01    Last update: May 23, 2009 19:49:46
This topic comes up once in a while: I need to generate a random string in JavaScript to get around browser (IE) cacheing. Method 1 (not really random, but a new value every millisecond): function randomString() { return '' + n... Method 2 (generate a random alpha-numerical string): function randomString(length) { var chars =...
Created by Dr. Xi on January 09, 2008 03:47:31    Last update: August 31, 2008 16:33:28
Many times I need to test some JavaScript snippet before writing code. Maybe I forgot how some JavaScrpit function is supposed to work, maybe I saw some tricky JavaScript code and needed to figure out how it worked. I used MS scripting host for while, but found it cumbersome. Plus, DOM objects are not available in the scripting host. Below is a simple HTML page I created for this task. You can use the Logger.debug method to output debugging messages. <html> <head> <script language="JavaScript" ... For example, if you enter Logger.debug(unescape('http%3a%2f%2fwww.56.com%2fn... into the text area and click "Execute", you get the following output: http://www.56.com/n_v166_/c33_/17_/ bcd [obj...