[X]

SCRIPT FOR and EVENT

browser wars 1997 dead

Attaching a handler by naming the element and the event on the script tag itself.

In 2026: Internet Explorer only, and gone with it. A spec-compliant browser skips a classic script that carries a for/event pair like this, running it only when for is window and event is a load event, so the handler below never fired outside Internet Explorer. The engines that did run it threw instead.

Where it came from: Microsoft Internet Explorer 4 DHTML reference, 1997. MDN

<input type="button" id="btn" value="Click me">

<!-- IE only. A spec-compliant browser skips a for/event script entirely. -->
<script for="btn" event="onclick" language="JavaScript">
  alert("Handled by the FOR and EVENT attributes.");
</script>

<!-- What everybody should have written -->
<script language="JavaScript">
document.getElementById("btn").onclick = function () {
  alert("Handled the portable way.");
};
</script>
sandboxed demo · breaks nothing but itselfrestart

More in browser wars

all 19 in browser wars › · the whole library ›