即时获取input输入框里的内容 IE/非IE皆可兼容

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>getYourCurrentInputValue</title>
</head>
<body>
	
	<div><input type="text" size="20" maxlength="25"></div>
	<div><p></p></div>
	<script type="text/javascript">

		var yourInput= document.getElementsByTagName('input')[0]

		if (document.addEventListener) {
			yourInput.addEventListener('input', write, false);
		} else if (document.attachEvent) {
			yourInput.attachEvent('onpropertychange', write);
		}

		function write() {
			document.getElementsByTagName('p')[0].innerHTML= yourInput.value;
		}
	</script>
</body>
</html>