IE-Specific

However, there are two other varieties of IE-only hacks that are perhaps a bit more useful.

All of these work, in some form or another for IE. I tested them all in various flavors to arrive at my favorite (sic).

You can set up a test harness yourself using this code to see for yourself.
<style type=text/css>
body {
background-color:red;
_background-color:blue;
*background-color:green;
background-color:yellow\9;
}
</style>

One of my favorite mechanisms to do IE-specific CSS is to use the so-called dynamic properties available to IE5+ browsers. Firefox and Opera ignore these tags, so if, for instance you need a div of id “foo” to be 110 pixels in IE and 100 pixels in all other browsers, you would just do this:

#foo {
width: 100px;
width: expression(’110px’);
}

Of course, there are easier ways of doing this in IE if you just need a fixed value to appear, using the so-called IE CSS hacks like the star harck *width:100px or _width:100px; will only be interpreted by Internet Explorer, but when you need a truly dynamic property that is based on changing conditions, using “expression” is a valid tactic.

I began to encounter a strange Line 0. Object Required Javascript bug and spent the better part of a day trying to track down the cause. The bug was so severe that, when hit, it required me to close IE using Task Manager. I could not figure this one out and finally resorted to reconstructing the entire page, line-by-line until I found the problem.

I finally determined it occurred only when I added a <textarea> tag to the page. My current project is a Ruby on Rails app, which necessarily indludes the Prototype Library, so I initially wrote off this weirdity to the vagaries of Prototype and its many tens of thousands of lines of code.

In this context, an input type=text tag would do fine, so I switched to that and moved on.

Thinking to reuse a WordBalloon construct I had developed, I had modified this CSS to play off of .WordBubble the className vs the original #WordBubble the ID. Therefore, when I used the original:

<div id=”WordBubble” class=”WordBubble”>
<textarea>
</div>

things worked as expected.

However, when using:

<div id=”AnotherWordBubble” class=”WordBubble”>
<textarea>
</div>

The CSS, when evaluating the dynamic property, could not find “WordBubble” as it did not exist as an ID (see it’s now a className).

Although I realize this posting is somewhat confusing (I barely understand it myself), what I am trying to say is “When you get a Line 0, Object Expected” Javascript error and can’t figure out where it comes from, check your CSS for Expression use.

Our Mission

Render Corporation, founded in 1997, specializes in providing top Web Development talent to some of the most dynamic brands in the world.
We are experts in HTML/HTML5, CSS/CSS3 and Javascript, boasting a client list that includes nearly all of the top names in Silicon Valley.
Chances are, if you are a Javascript developer, you are already using code we developed.
We are actively seeking new clients, so if you require the best, contact us.