Posts Tagged ‘technology’

"bug" with onclick handlers in IE

Wednesday, June 25th, 2008

I had an issue today with Internet Explorer. An object with an onClick handler worked fine in Firefox and Safari, but in IE the handler only fired every other click. In the course of debugging I discovered that if I clicked slowly, it worked on every click. I realized that this was because IE must be registering an onDblClick event instead of two onClick events. A little testing confirmed this. I searched to see if someone else had the same problem, and found this page. User jamescover had the same issue and found a solution: use the onMouseUp event to handle clicks instead of onClick. He also directed the focus in the onMouseDown event, but I found that part to be unnecessary in my application. A demo of his solution can be found here. I’ll reproduce the code in this post in case that page ever gets taken down:

<script type=”text/javascript”>
<!–

var x = 0;
function addX(){
document['oFrm']['num'].value = x;
x++;
}

var y = 0;
function addY(){
document['oFrm2']['num2'].value = y;
y++;
}

//–>
</script>
This one invokes the function <b>onclick</b>
<form name=”oFrm”>
<input type=”text” name=”num” size=”5″ />
<input type=”button” value=”add” onclick=”addX();” />
</form>
This one focuses the text field <b>onmousedown</b>, then invokes the function <b>onmouseup</b>
<form name=”oFrm2″>
<input type=”text” name=”num2″ size=”5″ />
<input type=”button” value=”add” onmousedown=”this.focus();” onmouseup=”addY();” />
</form>

Maker Faire Videos

Thursday, September 20th, 2007

I’ve been planning to go to the Maker Faire in Austin, Texas this October, and I’m surprised none of you are interested in going too. If you’re not familiar with the kind of stuff that’ll be there, here’s some videos showing the cool stuff at the first two faires.

http://revision3.com/systm/makerfaire
http://revision3.com/systm/maker07

Check out information about this years faire at http://www.makerfaire.com.

Advanced but still Primitive

Wednesday, September 5th, 2007

This story about evolutionary hardware design was indeed, as the URL indicates, a damn interesting read. The thing that struck me the most was that the design the evolutionary algorithm came up with didn’t work on other chips of the same type, just on the chip on which it evolved. The minute differences between different chips of the same type are negligible if their use is limited to things we currently understand, but if the only constraint is the laws of physics then the solutions that evolve are so complex and out of the ordinary that, were we to understand them, our advanced tools would probably seem like sticks and rocks.

BARCamp Retrospective

Wednesday, July 11th, 2007

I never had a post-BarCamp update, and I don’t really intend to do much of one now, but I do want to highlight a few things in case you didn’t see them elsewhere and for myself in the future.

BarCamp was lots of fun. There were quite a few good talks. There was also disappointingly too little coding. I will definitely do it again next year, and I’ll prepare something more substantial than the non-talk I did this year on old technology. My non-talk proved very popular, lots of people were standing around as I demonstrated my ballista, and lots of people got the opportunity to play with it. I also made it in to all the videos I’ve seen from the event. Here they are:

BusinessPOV’s documentarian approach to covering the event.

Some random guy’s youtube video of SpecialKevin firing the ballista.

The best idea ever.