Here's a javascript tutorial I think you should be able to find what you're looking for in it. I didn't write it. It came off of a cd I got with HTML for dummies.

I've been looking through it and don't see anything that explains what you are asking though. I thought I had something that explained what you are asking specifically. I'll keep lookig for it.

Edit: Actually it's online here http://www.webteacher.com/javascript/index.html but I think it's nice in this lil zip file so I'm gonna leave it on here.