All pastes #77907 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-07-03 15:25 UTC
rendered paste body
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

	<head>
		<title>Test</title>
		<script type="text/javascript">
			
			function init() {
				document.getElementById('testInput').onkeyup = function() { alert('foo'); };
			}
			
			/* for Mozilla */
			if (document.addEventListener) {
				document.addEventListener("DOMContentLoaded", init, false);
			}
			
			/* for Internet Explorer */
			/*@cc_on @*/
			/*@if (@_win32)
				document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
				var script = document.getElementById("__ie_onload");
				script.onreadystatechange = function() {
					if (this.readyState == "complete") {
						init(); // call the onload handler
					}
				};
			/*@end @*/
			
			/* for Safari */
			if (/WebKit/i.test(navigator.userAgent)) { // sniff
				var _timer = setInterval(function() {
					if (/loaded|complete/.test(document.readyState)) {
						init(); // call the onload handler
					}
				}, 10);
			}
			
			/* for other browsers */
			window.onload = init;
		</script>
	</head>

	<body>
		<input type="text" id="testInput" />
	</body>
</html>