Tuesday, April 10, 2007

Hidden submit buttons and IE

Internet Explorer has this annoying bug that breaks submit-on-enter-key if the submit button is not visible during page load. Setting it to display:none and using position:absolute;left:-5000px both cause this bug to appear.

Here's one solution (assumes all submit buttons have a class="submit"):

<!--[if IE]>
<style type="text/css">
.submit {

This doesn't work in Firefox, so make sure you sniff for IE when applying this technique.

Thursday, April 5, 2007

fixing the IE7 onchange bug on checkboxes

IE7 thinks "onchange" means "onblurafterchange", here's a way to get around it in checkboxes.

if (jscript==5.7) {//if IE7
 var inputs = document.getElementsByTagName("input"), i=-1, l=inputs.length;
 while (++i!==l) {
  var inputs_i=inputs[i];
  if ((inputs_i.type=="checkbox")&&inputs_i.onchange) {
   inputs_i.onpropertychange=function() {if (event.propertyName=='checked') this._onchange();};

Wednesday, April 4, 2007

Javascript-based apps and images

So I had this prototype lying around for a few months. With Firefox, it looks pretty choppy and I've no idea how to fix it. Opera and IE look ok though.

Unfortunately we can only reach a maximum of 60FPS with javascript, and that number goes down as other logic adds processing load. Considering how stand-alone compiled games usually render at approximately 75 FPS or more, I guess Javascript isn't suitable enough for fast paced games.