OK, so you can’t directly style the border of the SELECT element in IE, but if you’re using absolute positioning you can wrap it in a DIV, do the positioning and border on the DIV, then set a negative margin on the SELECT itself. I found that negative 1 pixel is right for drop-down selects, and negative 3 pixels is right for selects with a non-default size. Sample code below.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<style type="text/css">
#select1,#select2 {position:absolute;left:100px;border:1px solid #666;}
#select1 {top:100px;}
#select2 {top:150px;}
.drop {margin:-1px;}
.nodrop {margin:-3px;}
</style>
</head>
<body>
<div id="select1">
<select class="drop">
<option>One Hundred</option>
<option>Two Hundred</option>
<option>Three Hundred</option>
</select>
</div>
<div id="select2">
<select class="nodrop" size="3">
<option>One Hundred</option>
<option>Two Hundred</option>
<option>Three Hundred</option>
</select>
</div>
</body>
</html>
My Location
Mar 23, 2009
Mar 19, 2009
JavaScript to convert HTML character entity references
To convert all numerical character entities in a string to their character equivalents you can do this:
str.replace(/(\d+);/g, function (m, n) { return String.fromCharCode(n); })
str.replace(/(\d+);/g, function (m, n) { return String.fromCharCode(n); })
Mar 2, 2009
innerHTML and tables in IE
I have been doing some work on the performance of dynamically-created tables in our web application framework (which only works in IE). I used this QuirksMode performance comparison of innerHTML and the DOM as the basis for my work. Our framework was building the table using DOM methods inside loops, and I rewrote it using the array push/innerHTML method.
Rather than build an HTML string for the entire table, I attempted initially to build a string containing the <TR>s and set table.tBodies[0].innerHTML. This led me to discover that innerHTML is read-only on table elements in IE. How bloody typical. So I had no choice but to do the entire table.
UPDATE: This work turned out to be extremely successful and has made a huge improvement in the performance of our application.
Rather than build an HTML string for the entire table, I attempted initially to build a string containing the <TR>s and set table.tBodies[0].innerHTML. This led me to discover that innerHTML is read-only on table elements in IE. How bloody typical. So I had no choice but to do the entire table.
UPDATE: This work turned out to be extremely successful and has made a huge improvement in the performance of our application.
Password Management
I decided recently that I really needed to improve my password management. Using the same password in all sorts of places just isn't smart. The problem is finding a secure solution which is just as convenient. I tried KeePass for a month or so without really getting excited, but I've just stumbled across LastPass and the penny has dropped. My search is over. And at least one other person agrees with me.
Feb 27, 2009
Google Chrome
The more I use Google Chrome, the more I like it! The main thing is the speed, it absolutely screams compared to IE7 on script-heavy sites like Gmail. I also really like that each tab is a separate process; my machine has limited memory so having these processes means I can see which tabs consume the most memory, and if I close that tab I immediately get the memory back. The combined address/search bar works a treat as well.
When it first came out there were some noticeable bugs, so I kept using Firefox. But now, several updates later, it seems rock solid and I'm doing all my browsing with it.
It will be interesting to see how the market shares pan out. I predict we'll see slow but steady growth, unlike Opera which has never taken off. But it has no chance of overtaking Firefox unless it becomes cross-platform and contains an equivalent extension mechanism.
When it first came out there were some noticeable bugs, so I kept using Firefox. But now, several updates later, it seems rock solid and I'm doing all my browsing with it.
It will be interesting to see how the market shares pan out. I predict we'll see slow but steady growth, unlike Opera which has never taken off. But it has no chance of overtaking Firefox unless it becomes cross-platform and contains an equivalent extension mechanism.
Feb 13, 2009
List margins and padding
I had some trouble today getting my <ul> unordered list to position correctly across browsers. The problem turned out to be simply that the default style sheet in IE is different from the other browsers I tested in its settings for left margin and left padding.
The solution is simply to set values for both left margin AND left padding (use zero if you like) to get your list to position correctly across browsers.
The solution is simply to set values for both left margin AND left padding (use zero if you like) to get your list to position correctly across browsers.
Feb 5, 2009
Subscribe to:
Posts (Atom)