Javascript
This is version . It is not the current version, and thus it cannot be edited.
Back to current version   Restore this version

Style ändern#

    function findStyle(selectorText) {
      for (var i = 0; i < document.styleSheets.length; ++i) {
        var styleSheet = document.styleSheets[i];
        var css = styleSheet.cssRules || styleSheet.rules;
        for (var j = 0; j < css.length; ++j) {
          var rule = css[j];
          if (rule.selectorText == selectorText)
            return rule.style;
        }
      }
    }

Die Funktion kann dann wie folgt verwendet werden:

findStyle('.test').width = '100px';

Events#

Events aus Mozilla und IE bekommt man mit "event || window.event":
<input onkeypress="alert((event || window.event).keyCode);">

Focus und Keypress#

Normale Elemente bekommen Key-Events nur mit, wenn sie einen Tabindex und den Focus haben:
<div tabindex="0" onkeypress="alert((event || window.event).keyCode);" onmouseover="focus();" onmouseout="blur();">
  TEST
</div>