Web Development

internet site development

Javascript: The Good Parts - book review

I banged through the new O'Reilly book by Douglas Crockford titled JavaScript: The Good Parts

Crockford is a very eminent programmer in the javascript community and I was excited to see a book come out by him. However, after reading it, I have to say it wasn't what I expected. I thought it was going to be a very detailed description of Javascript objects, and particularly JSON of which he developed and popularized. But what I found it to be was a description of what is good, bad and ugly about the language. Quite interesting for anyone who has used the language for any length of time, and would consider themselves adept in the language. At times I think I am adept, but I find when I begin to think that I get challenged to the point that I really don't know much at all.

Read more

Regex in javascript

I needed to create a toggle image in a menu. I decided to check the image src to see what image it was on. Regex in javascript to the rescue. Here is what I used to parse only the image name.

var re = /([\w\/\.\\:]*\/)([\w\.]*)/;
var imgSrc = $('toc').src;
var myArray = re.exec(imgSrc);
if (myArray[2] == "toc_open.png") {
$('toc').src = "images/toc.png";
}
else {
$('toc').src = "images/toc_open.png";
}

Read more

Setting nested DOM element attributes

I needed to set some attributes for some anchors in an iframe. I wanted them to open in the parent frame. The problem was I only wanted certain ones that were inside of certain elements. I wrote this javascript loop to find the <a> elements inside of the div with the id of "re".

Read more

Safari has new web developer tools

Safari has included the webkit tools that the Webkit Open Source Organization has been working on. It looks very nice, but still not quite as powerful as the web tools available to Firefox. You can't actually edit the css on the page through the tool, but you can get a nice look at what styles are being appled to what elements. You right click on elements and say inspect element. The Web Inspector opens to that element. It has four tabs - Node, Style, Metrics and Properties. Using the tabs you can see how the browser is rendering the elements.

Read more

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.
Permissions beyond the scope of this license may be available at www.bradrice.com.

RSS Feed  My RSS Feed