the coding room

a place for coder talks

IE reserved keywords

Once again i fell into the hands of the evil one.

I was implementing this extension to YUI’s extenion :) that generates nice looking charts. I had everything working on Firefox when I saw that the chart, along with other things, did not generate on IE. I said to myself that it must be my fault, not the YUI or the extensions’ fault. So I went debugging, which you all know is not trivial in IE.

I spent an hour or so just to find out that Yahoo’s connector was not building the query string at all in IE when reading a form with Connector.setForm().
So I took a look inside my template to see what was going on and after a dozen checks It turned out to be the INSANE fact that I was using the word ‘length’ as an id.

I mean, who do I think I am to use ‘length’ as id. I must be crazy.

After a very small search about reserved keywords I found this blog entry.
I do not know how many of you have fallen into this trap but it is common to ignore some ( rare ) things up until the moment the nature of programming makes us face them. And once again, I found something about IE that I didn’t know and once again I wanted to kill it.
But the least I/we can do is raise more anti-IE awareness for the sake of web developers firstly :) and general web security secondly!! Am I ignorant?

Posted in Internet Explorer, Firefox, IE, HTML, Web Development, Javascript | 1 Comment »

IE bug?

I don’t know about you folks, but I have a little function I call to get an element by its id and it goes something like this

function getObj( pID ) {
    if( util.docRoot.getElementById )
    {
        return util.docRoot.getElementById( pID );
    }
    else if( util.docRoot.all )
    {
        return util.docRoot.all[pID];
    }

    return false;
}

For example, we have two <input> fields as such

<input type=”text” id=”shakeit” name=”shakethis” value=”valueA” />

<input type=”text” id=”shakethis” value=”valueB” />

Well, in Firefox, when I do

var someElement = getObj( ’someID’ );

the someElement contains the element with ID equal to “shakethis”, as expected.
In Internet Explorer though, someElement contains the first occurence of “shakethis”
even if it matches the name of the <input>.

Which, in the above example, means that if we were to print someElement.value this would be equal to “valueB” in Firefox
and “valueA” in IE.

Weird bug or just me being totally ignorant??

Or, as someone would say, is it a bug or a feature??

Posted in HTML, Web Development, Javascript | No Comments »

A pop-up on mouseover with Ajax

I was working till seven o’clock yesterday trying to see why the floating box I had created two weeks ago sometimes would not give up and disappear.

The story behind this project

The project is an online jewellery catalog, although you can think of it as an image gallery for simplicity. The goal is to show a pop-up bubble box, when the mouse is over an image, with extra information about that particular product.
Read the rest of this entry »

Posted in Web 2.0, Web Development, Javascript, Ajax | No Comments »