Archive for January, 2007

Change img-src for IE

It’s impossible, how much additional work the most used browser is putting on a web dev. I think during the last four weeks I have been wasting at least 30% of my time searching for workarounds for IE. This is really becoming a drag.
One simple thing I was searching for today, was how to replace an image’s src attribute with a new value, a new image so to say. I implemented he most obvious way, of course.


var img = dojo.byId("“);
img.src = “/new/img.jpg”;

This doesn’t work in IE :-(. Some pages had some tips on workarounds, but they are all quite ugly or not feasible in my case. So I took the next obvious turn and replaced the image like so.


var img = dojo.byId("“);
var newimg = new Image();
img.src = “/new/img.jpg”;
dojo.dom.replaceNode(img, newimg);

In this example I am using dojo to do the DOM work, you can do this by hand of course too.
The only tiny problem left, is that it flickers a little bit in IE, when the image changes. But currently that is not bothering me. But if you got a simple solution let me know. (I know you could overlay the new image, replace the old one remove the overlayed, and so on, but currently that does not seem worth the effort for me.)

Comments (13)

Dojo: Render a widget programmatically

I jus thad the problem, that I update my site on certain events and sometimes this site also contains some dojo widget. No I had the problem that this widget was not rendered again, to become eg. a nice combobox. After following the trail of djConfig.searchIds and trying it I can tell you that the following piece does the trick:

var parser = new dojo.xml.Parse();
var frag = parser.parseElement(dojo.byId("“), null, true);
dojo.widget.getParser().createComponents(frag);

The only thing you need to know is the of the element that you want to be parsed. To me that looks like it should be one simple function, since it doesn’t sound like a very uncommon functionality.

Comments (2)

Der Service von freelancermap.de

Nachdem freelancermap.de mir mehrere Mails schickte mit dem Subject “Projektanfrage” oder “Termin zum Vorstellungsgespräch” oder so ähnlich und weiterführende Links mich immer nur zum Bezahlen aufforderten entschied ich mich den Account zu kündigen. Eine wirklich nette Mail kam als Antwort:
freelancermap.jpg

Comments (2)