Archive for the 'javascript' Category

Mike Dives Into Greasemonkey

Friday, October 19th, 2007

I wrote my first Greasemonkey script this week. I consider this a big step in my JavaScript self-education.  The script wasn’t complicated.  I’d post it, but it was for an internal report that I’ve been working with so it really wouldn’t be worth your time. The report is a list of customer and some information [...]

Why JavaScript is important

Wednesday, June 13th, 2007

Mitchell Baker posted on Firefox’s effort to implement ECMAscript 4 (which is really JavaScript with another name) and she said:JavaScript is a fundamental element of the web. It’s fundamental in human interaction with the web. Updating JavaScript’s capabilities updates the power of the web itself.I agree with her. You may dismiss JavaScript as a toy; [...]

More YUI joy

Wednesday, June 6th, 2007

YAHOO.util.Dom.  How much I love thee. Let me counts the ways:setStyle and getStyle get the real styles of the elements, not just the inline styles.getElementsByClassName.  Say no more.Find and Position your elements where you want themNot part of the Dom object, YUI supplies a reliable way to extend objects. The syntax leaves a bit to [...]

A JavaScript Function Map

Thursday, May 17th, 2007

I spent my morning fixed problems with JavaScript. By “problems” I mean “fixing code that three or four iterations of developers have been too lazy to do correctly.” Here is simplified version of a particularly stupidly-written function that I uncovered:

function addItem(f,addtype) { if (addtype=”ab”) { f.hideme.value=”; functName1(); } if (addtype=”bc”) { f.hideme.value=”; functName2(); [...]

The JavaScript Identity Operators

Monday, May 14th, 2007

I’ve heard rumors of this before, but didn’t quite grok it. And now that I do, it’s very cool yet very strange. To demonstrate:

js>var n = “1″ js>1==n true js>1===n false

Yep, n is both equal and unequal to 1. But what’s up with that === operator? As many of you know, JavaScript is dynamically typed. [...]

YUI TreeView

Thursday, May 10th, 2007

As usual, it’s quiet around here because my life hasn’t been so quiet lately.  Lots happening at work and lots happening at home.  And I still don’t have my lawn mowed.

And one of my things I seem to be lacking on blogging is JavaScript. But that doesn’t mean I haven’t been using it!  No, I [...]

Gotta Love IE

Sunday, March 18th, 2007

I have been working on a site that uses a lot of YUI components — specifically Grids and Menubar. They were both CSS based, even though the Menubar required a touch of JavaScript, like so:

var oMenuBar = new YAHOO.widget.MenuBar(”menubar”, {visible: true, [...]

Array Functions for JavaScript

Friday, March 16th, 2007

I was going to go through the exercise of doing this myself, but it seems that someone already beat me to it. That’s okay — I’ll stand on the shoulders of giants.

These methods first check to make sure that they do not already exist on the Array object. If they do, they don’t [...]

JSON — not just for AJAX

Monday, March 12th, 2007

I recently blogged on the evils of mixing Java and JavaScript in JSP pages but didn’t give any good ways around it.  I mean, you have a list or array in Java and you want JavaScript in the JSP page to access this data — how do you do that?

Let me introduce you to to [...]

Mixing inline JSP code with JavaScript

Tuesday, March 6th, 2007

Before I get started, let us all repeat three times: “Inline JSP is evil.” Now that we are all on the same page . . .

I’ve inherited a project that has a ton of JSP’s with inline code. This code specifies a lot of logic and decisions that, frankly, should be back at [...]