62,271
社区成员
发帖
与我相关
我的任务
分享
<head>
<title>Test Text Changing</title>
<script type="text/javascript">
function TextChange(InputStr) {
Result.innerText = InputStr.replace(/^\s+|\s+$/g, "") - 1;
}
</script>
</head>
<body>
<input type="text" id="InputBox" onpropertychange="TextChange(this.value)" oninput="TextChange(this.value)" />
结果:输入值-1=<label id="Result"></label>
</body>