Categories
Web Development

Internet Explorer – Operation Aborted

In one of my current assignments, I am working on creating a visual element in JavaScript. This involves dynamic generation of page elements through the page DOM. I attempted to attach the dynamically generated element to the body element, and then re-positioned it somewhere on the page.
This worked fine in Firefox (common theme, it also follows the DOM event model – while Internet Explorer does not). It did not work fine in Internet Explorer displaying the message:

Internet Explorer cannot open the Internet site http://example.com.
Operation aborted.

Microsoft knows about this and other issues but so far did nothing to correct it.

The solution – based on one mentioned on the afore-linked page – is to not call the DOM method appendChild() on the body element. Place an empty div and append the child elements to it instead.

Yaay hacky!

Share
Categories
Web Development

JavaScript Globals

If you ever wrote mildly substantial JavaScript, you noticed that that JavaScript is not as premiscuous as it may appear when it comes to namespaces.
If you define a variable outside any block of code, that variable is not necessarily available within the body of functions, say.
The solution is to use the a real global element and ‘attach’ it the global value as property. The object of choice is window and the solution is as simple as
window.myProperty="Yuval";
Thereafter the global value is accessible as
window.myProperty

Very elementary, but I always forget these facts…

Share
Categories
Web Development

CSS positioning does not negate using tables

No matter how much you work with CSS and tricked out positioning, you will have a problem creating a table without actually using one.
See, the problem has to do with height, the bane of most browser design, and drawing the bottom border. You can create a bunch of <div> elements that float right next to each other, you can even draw borders on the sides and everything will appears hunky dory except for the fact that divs do not give a hoot about the aligning their bottom borders. You can be a wiseass and set the div height in the stylesheet, but then your are married to a specific height. If a user puts just a tiny bit too much data, it will not look nice.
So you can use tables. Not for layout, but just to display data in tabular format. No one will die, I will not tell and definitely the CSS god allows that.
Tables are for tables.

Share
Share