Recent Notes

Displaying keyword search results 31 - 40
Created by James on August 09, 2009 04:15:18    Last update: August 09, 2009 04:18:25
Operator Description Examples == is equal to '5' == 5 is true 3 == 3 is true 3 == 'a' is false === is exactly equal to (value and type) 5 === 5 is true 5 === '5' is false != is not equal to 5 != 8 is true 5 != 'a' is true 5 != '5' is false > is greater than 5 > 8 is false 5 < 8 is true 'a' < 'c' is true 'a' > '5' is true 'a' < 5 is undefined 'a >= 5 is undefined < is less than >= is greater than or equal to <= is less than or equal to Logical operators can be tricky. When in doubt, use Dr. Xi's JavaScript executor...
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 September 01, 2008 02:19:31    Last update: May 23, 2009 16:50:10
Use this bookmarklet to set or delete cookies in a web page. If you leave the expires date as is, the cookie will be deleted. Add this link to your bookmarks to install the bookmarklet. <html> <body> <a href="javascript:if (!windo...
Created by James on May 03, 2009 20:25:10    Last update: May 03, 2009 20:25:10
Some interesting information about getting the value of tabindex with JavaScript: http://www.fluidproject.org/pipermail/fluid-work/2007-December/001129.html Especially, IE returns 0 when tabindex is not set, making it indistinguishable from where tabindex is set to 0.
Created by Dr. Xi on March 02, 2009 23:29:08    Last update: March 28, 2009 21:35:41
An HTML form contains more than what meets the eye. This bookmarklet displays information about form fields in the page. When there are multiple forms on the page, successive invocations of the bookmarklet display each form in turn. Add this link to your bookmarks. Here's the code: <html> <body> <a href="javascript: i...
Created by Dr. Xi on August 28, 2008 22:52:01    Last update: March 28, 2009 16:50:42
As a web developer, a lot of times I need to see the cookies in a page (and copy the value to another test program, sometimes). This is a bookmarklet to display the cookies. You may directly add this link to your bookmarks and name it "show cookies". It doesn't work in IE6 because of the JavaScript length limitations . However, you may try putting the script on a web server and importing it to the bookmarklet. <html> <body> <a href="javascript: i...
Created by Dr. Xi on January 29, 2009 21:33:44    Last update: January 30, 2009 17:43:33
You can use applet , object , or embed tags to embed an applet in your HTML page. However, The applet tag is interpreted by both IE and Mozilla family of browsers. The applet tag won't automatically download a JRE if the Java Plug-in isn't already installed. The object tag works only for IE The embed tag works only for Mozilla family of browsers, i.e., Firefox. Use applet tag: <applet code="MyApplet.class" width="200" ... Use object tag: <!-- latest JRE --> <OBJECT classid="clsid:... Use embed tag: <!-- highest JRE that supports MIME type ... Mixed object and embed tag: <object classid="clsid:8AD9C840-044E-11D1-B3E9... You need to use a different name for the Mozilla embed tag and use that name to refer to the applet...
Created by Dr. Xi on January 30, 2009 16:57:12    Last update: January 30, 2009 17:25:36
The scriptable attribute defaults to false . However, even when you set it to true , there is a time delay between when the applet is loaded and when it becomes scriptable . The following code may fail: <html><body> <object classid="clsid:8AD9C840-04... You need to wrap the JavaScript like this: <script language="JavaScript" type="text/javascrip...
Created by Dr. Xi on September 01, 2008 01:01:59    Last update: September 02, 2008 15:55:05
In JavaScript, null is not the same as "undefined". The value null is an object, while "undefined" is, well, undefined. However, for undefined variable a , if (a){...} throws exception, but if (window.a) {...} returns false , even though they are the same thing! // 1. for undefined variable a, typeof functio...
Previous  1 2 3 4 5 Next