Note that the sample code illustrates how to do something; wholesale copy and paste may not work.
Double-clicking a code box will select all of the code.
Links and forms followed by
will open in a new window.
§ Most important things to remember
0 Comments added to this post
"Keep It Simple Stupid!" (KISS principle)
"If it ain't broke, don't fix it!"
(Remember, this is mostly for me; I'm not trying to call you stupid.)
0 Comments added to this post
§ Helpful links
0 Comments added to this post
If you're looking at this blog, I hope you are already familiar with these sites:
w3schools.com explains how things work with try it yourself examples.
quirksmode.org explains why things don't work in your browser.
Another site you might like is Jakob Nielsen's useit.com. It has a lot of advice focused on usability. I like this bit:
Jakob's Law of the Web User Experience states that "users spend most of their time on other websites."
The point being that if you make a really nifty design with really cool effects, but visitors can't find the scroll bar or tell if something is a link or not, they won't stick around. You may have really impressed them, but not the way you intended...
When I search google and find myself on the same page... again... I'm putting a link here!
Add and Remove Elements with JavaScript (reprise) Thank you Dustin Diaz!
Regular Expression Quick Start from regular-expressions.info.
A gold mine of articles from Mitchell Harper at Dev Articles. Hasn't been updated for a while, but the information is just as true today.
What's the deal with document.documentElement? I thought it was document.body... More doctype issues, especially good ol' IE, at document.body, doctype switching, and more.
Good gosh, how many times have I looked at this page: $_SERVER[’PHP_SELF’], $_SERVER['REQUEST_URI'], and $_SERVER[’SCRIPT_NAME’]?
0 Comments added to this post
§ Avoid email harvesting with javascript
0 Comments added to this post
- Tags:
- javascript
I don't like to put real email addresses on web pages because "harvesters" look for them to add to their spam list. However, harvesters probably don't run javascript before searching.
§ IE App Compat VHD
0 Comments added to this post
Download Virtual PC VHD files (virtual hard drive) with XP or Vista and IE6, IE7, or IE8 at:
These expire periodically; the download page tells you when it will expire. Microsoft links change all the time, so you may have to search instead.
You also need Virtual PC, a free download from Microsoft.
0 Comments added to this post
§ External links to new windows
0 Comments added to this post
- Tags:
- javascript
Ok, there's lots of REALLY HEATED discussions about this topic all over the web. I'm not looking for arguments; I'm just posting what I do here in this blog.
§ Format apache directory listing
0 Comments added to this post
- Tags:
- htaccess
The default directory listing apache shows is controlled by mod_autoindex and it has some options available.
§ My XP startup items
0 Comments added to this post
I have a couple of shortcuts in my startup folder. These are the "Target" lines of the shortcuts.
The first one gets rid of explorer's showing every zip file as a folder. You know how many zip files I've got? The /s at the end makes it not show a dialog box when it's finished.
%windir%\system32\regsvr32.exe /u zipfldr.dll /s
The second maps w: to my localhost root. Good ol' DOS commands!
%windir%\system32\subst.exe w: e:\wamp\www
0 Comments added to this post
§ Simple AJAX request
0 Comments added to this post
- Tags:
- ajax
Almost all of my AJAXing is to simply grab the output of a source and stuff it in in a div. In previous posts you can see what I've been using for a long time, but I wanted to make a function I wouldn't have to edit every time I used it in a project.
§ Validating email addresses (it's impossible) (Rant Alert!)
0 Comments added to this post
- Tags:
- validation
Search google for "validate email address" and you'll get about 303,000 results. I bet all of them are wrong...
Short version:
Why bother? I'm probably going to enter "example@example.com" anyway.
§ Adding & removing element classnames
0 Comments added to this post
- Tags:
- css
- javascript
A couple of ways to change classnames of elements.
§ Table row hover highlight
0 Comments added to this post
- Tags:
- css
- javascript
A bit of javascript to highlight the table row under the cursor.
§ Handling url get string with javascript
0 Comments added to this post
- Tags:
- javascript
Using javascript to handle url get string variables
§ Better tabbed interface
0 Comments added to this post
- Tags:
- javascript
- tabbed interface
Tabbed interface using get string to set active tab.
§ Auto replace textareas with fckeditor
0 Comments added to this post
- Tags:
- fckeditor
- javascript
Simple function to replace any textarea with fckeditor.
§ Simpler validate form fields are filled in (no additional class names)
0 Comments added to this post
- Tags:
- css
- javascript
- validation
Makes sure something is entered in form fields. If your form fields have classnames, don't use this one!
§ Validate form fields are filled in (additional class names)
0 Comments added to this post
- Tags:
- css
- javascript
- validation
Makes sure something is entered in form fields. Uses regex to replace classnames so other classnames aren't affected.
§ Javascript function to add css
0 Comments added to this post
- Tags:
- css
- Greasemonkey
- javascript
This javascript is a way to add an extra style node (css) into a page.
§ setInterval to stay logged in
0 Comments added to this post
- Tags:
- Greasemonkey
- javascript
Just a setInterval example to refresh a page.
§ Adding events to elements
0 Comments added to this post
- Tags:
- events
- javascript
For most elements, you can just do element.onclick = function_name. But read on...
(Much better article available at Add and Remove Elements with JavaScript (reprise) from Dustin Diaz.)
§ Image tabbed interface controlling hidden divs
0 Comments added to this post
- Tags:
- css
- javascript
- tabbed interface
Tabbed interface using images for rounded tabs. Gives decent results even if javascript and/or css are off.