April 29, 2009

Setting an HTML element’s class with Javascript

I was pulling my hair out trying to figure out why I was getting a parse-error with this code… DUH!

document.getElementById('test').class = "test"

“class” is a reserved name, of course… So you access it with:

document.getElementById('test').className = "test"

May 26, 2008

Don’t Change Your URLs

http://www.w3.org/Provider/Style/URI.html

June 18, 2007

Getting a RewriteCond to work

Wondering how to get a nice url such as

http://www.farmsoftstudios.com/tools/ajax/tutorials.html

to run a query for you? Here’s how to get this url: http://www.farmsoftstudios.com/tools.php?type=ajax&style=tutorials to the url listed above. You’ll need a .htaccess file in the directory that you are working from. Create that, and then add these lines:

RewriteEngine On
RewriteBase /your/sub-directories/if/any
Options +FollowSymLinks
RewriteRule tools/(.*)/(.*)\.html$ tools.php?type=$1&style=$2

To dissect that, first, you are calling an apache directive called RewriteRule. That tells apache that you want this url rewritten. Then you list the structure that you want created. In our case, that is tools/ (which is static) and then the query’s “variables.” What I mean by that is when I type

http://www.farmsoftstudios.com/tools/ajax/examples.html

into the address bar, it creates a new query with &style=example instead of tutorials. Pretty slick, eh?

April 26, 2007

AJAX Contact Form

I am releasing a beta-version of my new AJAX contact form. you can find it here: contact.php. Notice that all the links on the top are just there to show you how it would look as placed in a webpage. Comments, bug-reports, or anything else are appreciated. Thanks!

April 13, 2007

New Contact Form

I totally rewrote the contact form, making it a completely table-less design. The form validation still works, and the code is a whole lot cleaner now.

Go ahead and try it out!